-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Fix macOS build with all sanitizers enabled. #47939
Conversation
Sanitizer messages on editor startup on macOS:
godot/thirdparty/nanosvg/nanosvg.h Lines 2186 to 2190 in 0c8ec72
godot/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp Lines 2717 to 2719 in 0c8ec72
|
@bruvzg You're totally right about the leak detection I do think we should also consider that LLVM could be used on OSX directly: Apparently we can support leak detection if we use the LLVM/clang but not the one shipped from apple. Also docs states OSX support: I think we should fix it, I see there are linker problems. The manual says to use clang++ to do the linking portion too.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the problem, if we can support LeakSanitizer in the future on OSX it would be nice, but not something we can fix tonight I don't think.
platform/osx/detect.py
Outdated
env.Append(CCFLAGS=["-fsanitize=bounds-strict"]) | ||
env.Append( | ||
CCFLAGS=[ | ||
"-fsanitize=nullability-return,nullability-arg,function,nullability-assign,implicit-signed-integer-truncation,implicit-unsigned-integer-truncation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove implicit-unsigned-integer-truncation
and implicit-signed-integer-truncation
from Linux, Mac and Server build?
I was almost sure that I removed that flags, but looks that they still exists here.
They cause error spam just like you show at the top:
thirdparty/misc/pcg.cpp:12:27: runtime error: implicit conversion from type 'unsigned long long' of value 111260437319 (64-bit, unsigned) to type 'uint32_t' (aka 'unsigned int') changed the value to 3886254919 (32-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior thirdparty/misc/pcg.cpp:12:27 in
core/variant/variant.cpp:2852:11: runtime error: implicit conversion from type 'int64_t' (aka 'long long') of value -1 (64-bit, signed) to type 'uint32_t' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior core/variant/variant.cpp:2852:11 in
thirdparty/nanosvg/nanosvg.h:2190:49: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior thirdparty/nanosvg/nanosvg.h:2190:49 in
With this flags it is very hard to find real errors in code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove implicit-unsigned-integer-truncation and implicit-signed-integer-truncation from Linux, Mac and Server build?
Done.
Thanks! |
Some sanitizer flag fixes for macOS (#40924 follow-up).
use_llvm
environment variable, macOS build is LLVM only.-fsanitize=leak
is not supported as standalone flag (it is integrated into address sanitizer, see: https://clang.llvm.org/docs/LeakSanitizer.html).-fsanitize=implicit-integer-sign-change
is not supported.Also removes
implicit-signed-integer-truncation
andimplicit-unsigned-integer-truncation
.