[Bug c++/59083] -fisolate-erroneous-paths produces illegal instruction with enabled -fprofile-generate

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 13 07:42:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59083

--- Comment #12 from Jeffrey A. Law <law at redhat dot com> ---
I'll note further, that an implementation of sprintf, memcpy, etc could check
for a NULL pointer internally and raise a trap on their own rather than
dereferencing the invalid pointer and still be a conforming implementation.

In summary, you can't make the assumption that you'll actually get a
segfault/bus error like your code wants to do.

Contrast that to an explicit *0 = <whatever> which might appear in user code. 
While executing that code still results in undefined behaviour, one can easily
make an argument from a QOI standpoint that we should still allow the memory
dereference to occur to generate the SIGBUS/SIGSEGV.



More information about the Gcc-bugs mailing list