This is the mail archive of the
mailing list for the GCC project.
Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andrew Haley <aph at redhat dot com>, Jeff Prothero <jprother at altera dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 20 Feb 2015 12:45:14 +0100
- Subject: Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- Authentication-results: sourceware.org; auth=none
- References: <pdf61azt48b dot fsf at sj-interactive3 dot altera dot com> <54E6FEA4 dot 8000104 at redhat dot com>
On 02/20/2015 10:30 AM, Andrew Haley wrote:
> I doubt that such a thing is ever going to be safe. The idea that a
> null pointer points to nothing is so hard-baked into the design of C
> that you can't get away from it. Also, almost every C programmer and
> especially library writer "knows" that a null pointer points to
NULL pointer dereferences (or NULL pointer with small offsets) were
common programming idioms in the DOS days because the interrupt vector
table was located at this address. Quite a few systems once had a
readable page zero, and (manual, I assume) optimizations for list
traversal (p != NULL && p->next != NULL â p->next != NULL) were commonly
used on these systems.
I think the treatment of pointers not as addresses, but something that
has type information and provenience associated with it, came much
later, when most of the design was already settled.
Florian Weimer / Red Hat Product Security