mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
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 <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -257,10 +257,12 @@ clang.objc.options.linker = "-lobjc -lgnustep-base"
|
||||
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"
|
||||
@end
|
||||
|
||||
# seqs_v2 violates strict aliasing.
|
||||
gcc.options.always %= "${gcc.options.always} -fno-strict-aliasing"
|
||||
# -fno-math-errno is default in OSX, iOS, BSD, Musl, Libm, LLVM, Clang, ICC.
|
||||
# See https://itnext.io/why-standard-c-math-functions-are-slow-d10d02554e33
|
||||
# and https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Optimize-Options.html#Optimize-Options
|
||||
gcc.options.speed = "-O3 -fno-strict-aliasing -fno-ident -fno-math-errno"
|
||||
gcc.options.speed = "-O3 -fno-ident -fno-math-errno"
|
||||
gcc.options.size = "-Os -fno-ident"
|
||||
@if windows:
|
||||
gcc.options.debug = "-g3 -Og -gdwarf-3"
|
||||
@@ -281,7 +283,7 @@ llvm_gcc.options.size = "-Os"
|
||||
# Configuration for the LLVM CLang compiler:
|
||||
clang.options.debug = "-g"
|
||||
clang.cpp.options.debug = "-g"
|
||||
clang.options.always = "-w -ferror-limit=3"
|
||||
clang.options.always = "-w -ferror-limit=3 -fno-strict-aliasing"
|
||||
clang.options.speed = "-O3"
|
||||
clang.options.size = "-Os"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user