[Bug target/85035] nios2: adding -fdelete-null-pointer-checks with -O2 enabled
sandra at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Oct 28 03:05:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85035
sandra at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandra at gcc dot gnu.org
--- Comment #3 from sandra at gcc dot gnu.org ---
I've looked at this on mainline trunk and I'm not convinced there's a bug here,
or at least not a nios2 backend bug.
The -fdelete-null-pointer-checks option is badly named. What it really does is
allow attempts to dereference a null pointer to be combined and/or replaced
with some other code sequence that also causes a trap. So in the isolate-paths
tree pass, we're getting
if (t_4(D) != 0B)
goto <bb 3>; [100.00%]
else
goto <bb 7>; [0.00%]
....
<bb 7> [count: 0]:
# iftmp.0_8 = PHI <0B(2)>
_9 ={v} iftmp.0_8->m_LL;
__builtin_trap ();
The long long read is tagged as volatile to prevent it from getting optimized
away from later passes, and -mno-cache-volatile says to use the io instructions
for volatile memory reads and writes.
More information about the Gcc-bugs
mailing list