gimp-2.10.36 fails to compile (lto): gimppalette-load.c:1098:24: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Environment/Versions
- GIMP version: 2.10.36
- Package: gentoo media-gfx/gimp-2.10.36 package (when compiled with
-Werror=strict-aliasing
) - Operating System: Gentoo Linux
Description of the bug
Reproduction
Is the bug reproducible?
Reproduction steps:
- Add compiler flags
-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
. - Try to compile.
…
Expected result:
Succesfully compiled
Actual result:
Compile error
...
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -DGIMPDIR=\""GIMP"\" -DGIMP_APP_VERSION=\"2.10\" -DGIMP_USER_VERSION=\"2.10\" -DG_LOG_DOMAIN=\"Gimp-Core\" -I../.. -I../.. -I../../app -I../../app -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/gegl-0.4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -pthread -I/usr/include/babl-0.1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi/include -I/usr/include/libpng16 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/libmypaint -I/usr/include/json-c -DMYPAINT_BRUSHES_DIR=\"/usr/share/mypaint-data/2.0/brushes\" -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi/include -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include -DGIMP_DISABLE_DEPRECATED -DBABL_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE -g -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Werror=missing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -Wmissing-format-attribute -Wformat-security -Wlogical-op -Wtype-limits -fno-common -fdiagnostics-show-option -Wreturn-type -c -o gimppalettemru.o gimppalettemru.c
gimppalette-load.c: In function ‘gimp_palette_load_ase’:
gimppalette-load.c:1098:24: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
1098 | pixels[j] = *(gfloat *) &tmp;
| ^~~~~~~~~~~~~~~
...
Additional information
See also (Gentoo issue): https://bugs.gentoo.org/917497
If you have a backtrace for a crash or a warning, paste it here.