Commit
1cb36665a25f7427a198a51bfc48927a52a4d5a8
by edwin.torok
Sanitizer(UBSAN): really enable UBSAN
The clang-14 docs are not clear about this, but the latest docs say: > -fsanitize-trap= and -fsanitize-recover= are a no-op in the absence of a -fsanitize= option. There is no unused command line option warning.
Avoid this trap and specify `-fsanitize=$ubsan` too.
Signed-off-by: Edwin Török <edwin.torok@cloud.com> (commit: 1cb3666)
Commit
0a88f1e3d0f520dc2f83125bb83add79f53d2691
by edwin.torok
Sanitizers(UBSAN): fix linker warning
Apparently >-O0 needs to be supplied when linking too: ``` clang: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled: -fsanitize=bool,builtin,bounds,enum,nonnull-attribute,nullability,object-size,pointer-overflow,returns-nonnull-attribute,shift-exponent,unreachable [-Winvalid-command-line-argument] ```
Signed-off-by: Edwin Török <edwin.torok@cloud.com> (commit: 0a88f1e)
Commit
7c081549379671b23fcd1089036f87c59a043505
by edwin.torok
Sanitizers: future proof by using -Og instead of -o1
This is currently equivalent to -O1 on clang, but may improve debuggability in the future compared to -O1.
GCC already disables certain optimizations at -Og, and recommends it when using the sanitizers: ``` To get more accurate stack traces, it is possible to use options such as -O0, -O1, or -Og (which, for instance, prevent most function inlining) ```
(there are also other flag recommendations, but I think they are only relevant if you want to use -O2 or higher, they wouldn't be active at -O1/-Og)
Also don't use -O0. Even for pure debugging, the manual recommends -Og: ``` It is a better choice than -O0 for producing debuggable code because some compiler passes that collect debug information are disabled at -O0 ```
Signed-off-by: Edwin Török <edwin.torok@cloud.com> (commit: 7c08154)