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