You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to build with the following *FLAGS to optimize the build: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
The -Werror=* flags are important to detect cases where the compiler can try to optimize based on assuming UB cannot happen, and miscompile code that has UB in it. strict-aliasing issues are always bad but LTO can make them even worse.
I got this error:
[1/625] /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -DLAF_LINUX -DLAF_SKIA -DNDEBUG -DPNG_NO_MMX_CODE -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -std=c++17 -MD -MT laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o -MF laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o.d -o laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp
FAILED: laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -DLAF_LINUX -DLAF_SKIA -DNDEBUG -DPNG_NO_MMX_CODE -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -std=c++17 -MD -MT laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o -MF laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o.d -o laf/base/CMakeFiles/laf-base.dir/cfile.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp: In function ‘float base::fgetf(FILE*)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp:117:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
117 | return *reinterpret_cast<float*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp: In function ‘double base::fgetd(FILE*)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp:159:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
159 | return *reinterpret_cast<double*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp: In function ‘int base::fputf(float, FILE*)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp:234:19: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
234 | const int b = *(reinterpret_cast<int*>(&l));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp: In function ‘int base::fputd(double, FILE*)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/cfile.cpp:257:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
257 | const long long b = *(reinterpret_cast<long long*>(&l));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
[2/625] /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -DLAF_LINUX -DLAF_SKIA -DNDEBUG -DPNG_NO_MMX_CODE -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -std=c++17 -MD -MT laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o -MF laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o.d -o laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp
FAILED: laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -DLAF_LINUX -DLAF_SKIA -DNDEBUG -DPNG_NO_MMX_CODE -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -std=c++17 -MD -MT laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o -MF laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o.d -o laf/base/CMakeFiles/laf-base.dir/serialization.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘std::ostream& base::serialization::little_endian::write_float(std::ostream&, float)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:60:19: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
60 | const int b = *(reinterpret_cast<int*>(&value));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘std::ostream& base::serialization::little_endian::write_double(std::ostream&, double)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:70:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
70 | const long long b = *(reinterpret_cast<long long*>(&value));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘float base::serialization::little_endian::read_float(std::istream&)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:129:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
129 | return *reinterpret_cast<float*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘double base::serialization::little_endian::read_double(std::istream&)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:151:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
151 | return *reinterpret_cast<double*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘std::ostream& base::serialization::big_endian::write_float(std::ostream&, float)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:185:19: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
185 | const int b = *(reinterpret_cast<int*>(&value));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘std::ostream& base::serialization::big_endian::write_double(std::ostream&, double)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:195:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
195 | const long long b = *(reinterpret_cast<long long*>(&value));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘float base::serialization::big_endian::read_float(std::istream&)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:254:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
254 | return *reinterpret_cast<float*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp: In function ‘double base::serialization::big_endian::read_double(std::istream&)’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf/base/serialization.cpp:276:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
276 | return *reinterpret_cast<double*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
[3/625] /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DENABLE_DATA_RECOVERY -DENABLE_NEWS -DENABLE_SAVE -DENABLE_SCRIPTING -DENABLE_UI -DENABLE_WEBSOCKET -DHAVE_CONFIG_H -DHAVE_CONFIG_OVERRIDE_H=1 -DLAF_LINUX -DLAF_SKIA -DLAF_WITH_REGION -DNDEBUG -DPNG_NO_MMX_CODE -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 -DSK_BUILD_FOR_UNIX -DSK_ENABLE_SKSL=1 -DSK_GAMMA_APPLY_TO_A8 -DSK_GAMMA_SRGB -DSK_GL=1 -DSK_INTERNAL -DSK_R32_SHIFT=16 -DSK_SCALAR_TO_FLOAT_EXCLUDED -DSK_SUPPORT_GPU=1 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/observable -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/fixmath/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/doc/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/skia-3338e90707323d2cd3a150276acb9f39933deee2 -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/cityhash/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Wall -Wno-switch -Wimplicit-fallthrough -std=c++17 -Wno-sign-compare -MD -MT src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o -MF src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o.d -o src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp
FAILED: src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DENABLE_DATA_RECOVERY -DENABLE_NEWS -DENABLE_SAVE -DENABLE_SCRIPTING -DENABLE_UI -DENABLE_WEBSOCKET -DHAVE_CONFIG_H -DHAVE_CONFIG_OVERRIDE_H=1 -DLAF_LINUX -DLAF_SKIA -DLAF_WITH_REGION -DNDEBUG -DPNG_NO_MMX_CODE -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 -DSK_BUILD_FOR_UNIX -DSK_ENABLE_SKSL=1 -DSK_GAMMA_APPLY_TO_A8 -DSK_GAMMA_SRGB -DSK_GL=1 -DSK_INTERNAL -DSK_R32_SHIFT=16 -DSK_SCALAR_TO_FLOAT_EXCLUDED -DSK_SUPPORT_GPU=1 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/simpleini -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/observable -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/aseprite-1.3.6_build/laf -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/fixmath/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/doc/.. -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/skia-3338e90707323d2cd3a150276acb9f39933deee2 -I/var/tmp/portage/dev-games/aseprite-1.3.6/work/third_party/cityhash/src -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Wall -Wno-switch -Wimplicit-fallthrough -std=c++17 -Wno-sign-compare -MD -MT src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o -MF src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o.d -o src/dio/CMakeFiles/dio-lib.dir/aseprite_decoder.cpp.o -c /var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp
/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp: In member function ‘float dio::AsepriteDecoder::readFloat()’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp:428:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
428 | return *reinterpret_cast<float*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp: In member function ‘double dio::AsepriteDecoder::readDouble()’:
/var/tmp/portage/dev-games/aseprite-1.3.6/work/src/dio/aseprite_decoder.cpp:468:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
468 | return *reinterpret_cast<double*>(&v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
I tried to build with the following *FLAGS to optimize the build:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
The -Werror=* flags are important to detect cases where the compiler can try to optimize based on assuming UB cannot happen, and miscompile code that has UB in it. strict-aliasing issues are always bad but LTO can make them even worse.
I got this error:
Originally reported downstream: https://bugs.gentoo.org/924692
Full build log: build.log
The text was updated successfully, but these errors were encountered: