-
Notifications
You must be signed in to change notification settings - Fork 156
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
Multiple build errors: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] #261
Comments
Workaround: compile files without the offending options. |
Already temporary workarounded (https://bugs.gentoo.org/858338) but several distributives currently prefer to build packages with LTO enabled by default or planning to do this. It seems that #257 fixes one of error for sqcompiler.cpp |
LTO necessarily implies no-strict-aliasing? |
To reproduce issue the |
It's incorrect to compile Squirrel without Squirrel compiles fine (except the static library which produces |
@rversteegen |
Some changes to the code could be made to avoid breaking the strict aliasing rules, by using unions in It would be a good idea to do so, to avoid depending on compiler flags, which can get lost when embedded in another project. |
When trying to build squirrel 3.1 or 3.2 with
-flto -Werror=strict-aliasing
enabled (without passing-fno-strict-aliasing
) the multiple errorsdereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
occur (example for quirrel 3.2 with other warnings):This results in compilation errors where squirrel is used as subproject (see Code::Blocks issue: https://sourceforge.net/p/codeblocks/tickets/1303/).
Steps to reproduce:
CmakeLists.txt
(example for squirrel 3.2) to provide-flto -Werror=strict-aliasing
flags and remove-fno-strict-aliasing
:The text was updated successfully, but these errors were encountered: