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

Markus <masmiseim at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #8 from Markus <masmiseim at gmx dot de> ---
Hello Andrew,

You are correct, dereferencing a null pointer is undefined in C/C++. Which
means the resulting behaviour can be specific to the target or compiler.
Undefined does not mean that it is forbitten.
But as accessing address zero is a well-defined behaviour on ARM targets I
would expect GCC to implement this behaviour when compiling for ARM. As
documented here
(https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Optimize-Options.html#index-fdelete-null-pointer-checks)
this is already done for AVR and MSP430. Why not also for ARM?

Clang may have a similar option, but it is per default disabled. Compare:
https://godbolt.org/z/hGfb4E991


@Jakub Jelinek
In many cases ARM forces you to place code here, as it expected to run from
address zero the very first instruction.

Regards

Reply via email to