Skip to content

Commit 3f48576

Browse files
bptatoringabout
andauthored
Disable strict aliasing on clang (#25067)
Workaround for #24596. I also took the liberty to disable it on all targets with GCC, since their documentation claims that it is also enabled on -Os. --------- Co-authored-by: ringabout <[email protected]>
1 parent 87ee9c8 commit 3f48576

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config/nim.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,12 @@ clang.objc.options.linker = "-lobjc -lgnustep-base"
257257
gcc.options.linker %= "-L $WIND_BASE/target/lib/usr/lib/ppc/PPC32/common -mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
258258
@end
259259

260+
# seqs_v2 violates strict aliasing.
261+
gcc.options.always %= "${gcc.options.always} -fno-strict-aliasing"
260262
# -fno-math-errno is default in OSX, iOS, BSD, Musl, Libm, LLVM, Clang, ICC.
261263
# See https://itnext.io/why-standard-c-math-functions-are-slow-d10d02554e33
262264
# and https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Optimize-Options.html#Optimize-Options
263-
gcc.options.speed = "-O3 -fno-strict-aliasing -fno-ident -fno-math-errno"
265+
gcc.options.speed = "-O3 -fno-ident -fno-math-errno"
264266
gcc.options.size = "-Os -fno-ident"
265267
@if windows:
266268
gcc.options.debug = "-g3 -Og -gdwarf-3"
@@ -281,7 +283,7 @@ llvm_gcc.options.size = "-Os"
281283
# Configuration for the LLVM CLang compiler:
282284
clang.options.debug = "-g"
283285
clang.cpp.options.debug = "-g"
284-
clang.options.always = "-w -ferror-limit=3"
286+
clang.options.always = "-w -ferror-limit=3 -fno-strict-aliasing"
285287
clang.options.speed = "-O3"
286288
clang.options.size = "-Os"
287289

0 commit comments

Comments
 (0)