[Scummvm-tracker] [ScummVM :: Bugs] #15039: Build fails with strict-aliasing violations
ScummVM :: Bugs
trac at scummvm.org
Fri Mar 22 02:05:45 UTC 2024
#15039: Build fails with strict-aliasing violations
-------------------------+--------------------
Reporter: eli-schwartz | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Tools
Version: | Keywords:
Game: |
-------------------------+--------------------
I tried to compile with LTO: `-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:
{{{
x86_64-pc-linux-gnu-g++ -MMD -MF "engines/grim/luac/.deps/dump.d" -MQ
"engines/grim/luac/dump.o" -MP -Wall -march=native -fstack-protector-all
-O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4
-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat
-Werror=format-security -DNDEBUG -g -W -Wno-unused-parameter -Wno-empty-
body -std=c++11 -I/usr/include/freetype2 -I/usr/include/harfbuzz
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -Wno-long-long -Wno-
multichar -Wno-unknown-pragmas -Wno-reorder -Wpointer-arith -Wcast-qual
-Wshadow -Wnon-virtual-dtor -Wwrite-strings -fcheck-new -DHAVE_CONFIG_H
-DPOSIX -I. -I. -I/usr/include/libpng16 -c engines/grim/luac/dump.cpp -o
engines/grim/luac/dump.o
engines/grim/luac/dump.cpp: In function ‘void DumpFloat(float, FILE*)’:
engines/grim/luac/dump.cpp:31:31: error: dereferencing type-punned pointer
will break strict-aliasing rules [-Werror=strict-aliasing]
31 | WRITE_LE_UINT32(out, *(uint32*)(&f));
| ^~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make: *** [Makefile.common:531: engines/grim/luac/dump.o] Error 1
}}}
Downstream report: https://bugs.gentoo.org/926081
--
Ticket URL: <https://bugs.scummvm.org/ticket/15039>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list