This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/62307] -fsanitize=undefined doesn't pay attention to __attribute__((returns_nonnull))


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62307

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The reason for implied -fno-delete-null-pointer-checks for -fsanitize=null,
-fsanitize=nonnull or -fsanitize=returns-nonnull is that the checks themselves
would be optimized away.  In theory we could implement those say by hiding them
from the optimizers through GIMPLE_ASM or similar, but we are there on a thin
ice, I feel trying to optimize the various -fsanitize=undefined checks too hard
risks that we optimize away some checks that actually should be performed.  Say
from VRP we find out that in valid program something shouldn't have out of
bounds value, but in invalid program it very well could have, and the checks
are meant to report invalid programs.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]