-
Notifications
You must be signed in to change notification settings - Fork 440
Description
While authoring #28227, I ran Chapel with CHPL_SANITIZE_EXE=undefined and also just did compiles with chpl --ccflags=-fsanitize=undefined --ldflags=-fsanitize=undefined. This was invaluable in finding the bug and fixing it, but I noticed a ton of other ubsan errors.
For example, the following code can result in C undefined behavior, because we end up with code like (uint64_t)0-(uint64_t)1, which is UB
for i in 0..#0 { }There were many other errors, and I actually got different sets of errors when using CHPL_TARGET_COMPILER=clang vs CHPL_TARGET_COMPILER=gnu.
This makes me want to go through and clean up all of this UB, and then lock it in with nightly tests for both clang and gnu (just like we do with asan already). In my opinion, these are all bugs waiting to happen, and I want to be proactive about fixing them.
At the bare minimum, I've opened https://github.com/chapel-lang/chapel/pull/28228/changes to document this tool for others to use in the future.