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

--- Comment #18 from Jeffrey A. Law <law at redhat dot com> ---
I'll also note that the plan for the isolated paths that exhibit undefined
behaviour is to have them trap/abort at the statement which triggers the
undefined behaviour.

The original patch from 2011 actually eliminated the undefined behaviour path
entirely, that's incorrect in that earlier code in the path might have
observable side effects (such as a printf call).  It would also make more
problems with "optimization unstable code".

By unconditionally trapping/aborting at the statement which triggered the
undefined behaviour (say a null pointer dereference), we still get any prior
observable side effects on the path and we halt the program at the point of
undefined behaviour, thus avoiding the multitude of problems around
"optimization unstable code".

Reply via email to