This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] avoid error_mark_node in -Wsizeof-pointer-memaccess (PR 88065)
- From: Jeff Law <law at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 19 Nov 2018 16:10:09 -0700
- Subject: Re: [PATCH] avoid error_mark_node in -Wsizeof-pointer-memaccess (PR 88065)
- References: <ead1fa8a-41ac-45c8-9cdc-192fdae28082@gmail.com>
On 11/17/18 3:45 PM, Martin Sebor wrote:
> -Wsizeof-pointer-memaccess fails with an ICE when one of
> the arguments is ill-formed (error_mark_node). To avoid
> the error the attached patch has the function bail in this
> case.
>
> Martin
>
> gcc-88065.diff
>
> PR c/88065 - ICE in -Wsizeof-pointer-memaccess on an invalid strncpy
>
> gcc/c-family/ChangeLog:
>
> PR c/88065
> * c-warn.c (sizeof_pointer_memaccess_warning): Bail if source
> or destination is an error.
>
> gcc/testsuite/ChangeLog:
>
> PR c/88065
> * gcc.dg/Wsizeof-pointer-memaccess2.c: New test.
This is probably OK. But before final ACK, is there a point earlier
where we could/should have bailed out?
ie, when does the ERROR_MARK get created and if you were to look at the
flow from that point to the offending call to
sizeof_pointer_memaccess_warning is there a better place to bail?
jeff