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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> note how it doesn't eliminate the actual load which probably causes the 
> odd code-generation.

The code says:

  /* We want the NULL pointer dereference to actually occur so that
     code that wishes to catch the signal can do so.

  /* If we had a NULL pointer dereference, then we want to insert the
     __builtin_trap after the statement, for the other cases we want
     to insert before the statement.  */

Maybe that should be protected by more flags, but it is done on purpose.

> security implications.

Those didn't convince me much at the time though, it is far from the only
transformation that can have such effect, and we are not consistent in using
trap vs unreachable.

Reply via email to