This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING] [PATCH] c/71392 - SEGV calling integer overflow built-ins with a null pointer
- From: Richard Biener <rguenther at suse dot de>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Eric Botcazou <ebotcazou at libertysurf dot fr>, Marek Polacek <polacek at redhat dot com>
- Date: Fri, 10 Jun 2016 09:02:56 +0200 (CEST)
- Subject: Re: [PING] [PATCH] c/71392 - SEGV calling integer overflow built-ins with a null pointer
- Authentication-results: sourceware.org; auth=none
- References: <5750BFA2 dot 5030508 at gmail dot com> <5759B6CE dot 9090900 at gmail dot com>
On Thu, 9 Jun 2016, Martin Sebor wrote:
> Attached is an updated version of the original patch described
> below to annotate with the nonnull attribute the Built-In Functions
> to Perform Arithmetic with Overflow Checking.
>
> Since the machinery that's in place doesn't handle the attribute
> on type-generic built-ins changes to the (handle_nonnull_attribute
> function in Ada and LTO besides C were required so I CC the
> maintainers for these areas.
The LTO bits are ok.
Richard.
> Thanks
> Martin
>
> On 06/02/2016 05:22 PM, Martin Sebor wrote:
> > In a discussion of a patch in a this area (c/68120 and c++/70507)
> > Jakub noticed that the integer arithmetic built-ins with overflow
> > checking that expect a pointer to an integer as the last argument
> > silently (i.e., without a warning) accept a null pointer. As the
> > test case in the bug referenced in in subject shows, such calls
> > then crash at runtime.
> >
> > The attached patch follows the same approach used by other built
> > ins that take a pointer to an object (such as __built_strlen) to
> > issue a -Wnonnull warning for such invalid calls.
> >
> > Martin
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)