8000 -Wstrict-aliasing warning (so unsuitable for LTO) · Issue #224 · libLAS/libLAS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

-Wstrict-aliasing warning (so unsuitable for LTO) #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thesamesam opened this issue Feb 29, 2024 · 1 comment
Open

-Wstrict-aliasing warning (so unsuitable for LTO) #224

thesamesam opened this issue Feb 29, 2024 · 1 comment

Comments

@thesamesam
Copy link
thesamesam commented Feb 29, 2024 8000

Many distributions are exploring use of LTO for their packages now.

When building with -flto -Werror=strict-aliasing -Werror=lto-type-mismatch -Werror=odr, I get:

FAILED: apps/CMakeFiles/las2pg.dir/las2pg.c.o 
/usr/bin/x86_64-pc-linux-gnu-gcc -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_IOSTREAMS_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DHAVE_LIBGEOTIFF=1 -I/var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/. -I/var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/../include -I/var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/../include/liblas/capi  -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -MD -MT apps/CMakeFiles/las2pg.dir/las2pg.c.o -MF apps/CMakeFiles/las2pg.dir/las2pg.c.o.d -o apps/CMakeFiles/las2pg.dir/las2pg.c.o -c /var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/las2pg.c
/var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/las2pg.c: In function ‘bigEndian_double’:
/var/tmp/portage/sci-geosciences/liblas-1.8.1-r3/work/libLAS-1.8.1/apps/las2pg.c:237:14: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  237 |         b = *(uint64_t *)&a;
      |              ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Originally reported downstream in Gentoo at https://bugs.gentoo.org/862585.

https://github.com/libLAS/libLAS/blob/master/apps/las2pg.c#L219 looks like it's just swapping bytes which can be done portably using the helpers at https://github.com/projg2/portable-endianness.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Feb 29, 2024
Reported the aliasing violation upstream.

Bug: libLAS/libLAS#224
Closes: https://bugs.gentoo.org/862585
Signed-off-by: Sam James <sam@gentoo.org>
@mloskot
Copy link
Member
mloskot commented Feb 29, 2024

Thanks for the report. Unfortunately, I can not promise any action. The project is in maintenance hibernation mode. We are happy to receive PR-s. Also, anyone interested in pushing the maintenance of the library forward, please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0