This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ubsan PATCH] Fix ICE with bounds checking on VLA-in-a-struct (PR sanitizer/70875)
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 May 2016 11:34:01 +0200
- Subject: Re: [ubsan PATCH] Fix ICE with bounds checking on VLA-in-a-struct (PR sanitizer/70875)
- Authentication-results: sourceware.org; auth=none
- References: <20160506092241 dot GO5348 at redhat dot com> <20160506092933 dot GD26501 at tucnak dot zalov dot cz>
On Fri, May 06, 2016 at 11:29:33AM +0200, Jakub Jelinek wrote:
> On Fri, May 06, 2016 at 11:22:41AM +0200, Marek Polacek wrote:
> > A program containing an array of structs containing a VLA caused ICE with UBSAN
> > bounds checking, because in get_ubsan_type_info_for_type we asserted that the
> > size of a type fits uhwi, which implies it is an INTEGER_CST. But that's not
> > the case for a struct with VLA. However, the assert here is bogus, for
> > !REAL_TYPE and !INTEGRAL_TYPE_P get_ubsan_type_info_for_type just returns 0.
> > And since tree_to_uhwi has
> > gcc_assert (tree_fits_uhwi_p (t));
> > there's no need to duplicate that for the REAL_TYPE / INTEGRAL_TYPE_P cases.
>
> Yeah, and for NULL TYPE_SIZE we just segfault, not really need to assert
> that.
> >
> > Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> Ok, thanks. If it affects 6.x branch, it is ok there as well.
Yeah, it does, and since I need to test a backport for PR70342 anyway,
I'll add it to my testing & commit it afterwards.
Thanks,
Marek