Referencing through a null pointer
Henry Spencer
henry at utzoo.uucp
Tue Apr 26 09:04:35 AEST 1988
> I imagine that PDP-11s without split I&D had *(char *)0 == 7 or 8, and
> *(short *)0 == 0407 or 0408 (OMAGIC and NMAGIC respectively).
Actually, no. The a.out header was not part of the actual core image, so
the first instruction of the program was first; in practice this was the
"setd" that got the floating-point processor into the right mode (or tipped
the software off that the processor lacked hardware floating point), which
gave *(char *)0 == 011 and *(short *)0 == 0170011. The programs which
made assumptions about *0 were generally the big ones, which ran split-space
of necessity.
--
"Noalias must go. This is | Henry Spencer @ U of Toronto Zoology
non-negotiable." --DMR | {ihnp4,decvax,uunet!mnetor}!utzoo!henry
More information about the Comp.lang.c
mailing list