From the HPUX cc, c89 - C compiler man page:
-z Do not bind anything to address zero. This option
allows runtime detection of null pointers. See the
note on pointers below.
-Z Allow dereferencing of null pointers. See the note on
pointers below. The -z and -Z are linker options. See
ld(1) for more details.
Then from ld(1)
:
The default value of the -Z/-z option is -Z.
This means that, by default, any C program compiled with this version of cc on HPUX that dereferences a null pointer will read the value as 0 and not segfault. There is no option for this with gcc or cc on RHEL. Does anyone know how I would compile a C program with an option like this on RHEL (to allow null dereferece)? I know this is a terrible coding practice and I will not be using it to create new code. Thank you.