This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- From: <Paul_Koning at Dell dot com>
- To: <law at redhat dot com>
- Cc: <fweimer at redhat dot com>, <aph at redhat dot com>, <jprother at altera dot com>, <gcc at gcc dot gnu dot org>
- Date: Fri, 20 Feb 2015 17:32:02 +0000
- 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> <54E71E4A dot 3050503 at redhat dot com> <54E76858 dot 40600 at redhat dot com>
> On Feb 20, 2015, at 12:01 PM, Jeff Law <law@redhat.com> wrote:
>
> ...
> Regardless, the right thing to do is to disable elimination of NULL pointer checks on targets where page 0 is mapped and thus a reference to *0 may not fault. In my mind this is an attribute of both the processor (see H8 above) and/or the target OS.
>
> On those targets the C-runtime had better also ensure that its headers aren't decorated with non-null attributes, particularly for the mem* and str* functions.
pdp11 is an example of such a target, independent of OS (with only 8 pages, clearly no one is going to unmap page 0). Fortunately there one is unlikely to find C program data structures at 0 (instead, vectors if kernel, stack limit if user mode). So no fault is correct there, but no null (0 bits) pointer is also â for practical purposes â a valid assumption.