On Mon, Dec 02, 2013 at 03:41:18PM +0100, Marek Polacek wrote: > On Mon, Dec 02, 2013 at 02:41:05PM +0100, Marek Polacek wrote: > > On Mon, Dec 02, 2013 at 03:52:09PM +0400, Konstantin Serebryany wrote: > > > This change breaks one ubsan test: > > > make check -C gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} > > > ubsan.exp' > > > FAIL: c-c++-common/ubsan/vla-1.c -O0 execution test > > > I am asking gcc-ubsan maintainers to help me decipher dejagnu > > > diagnostics and fix the test failure. > > > > Ok, reproduced. I'll look into it. > > Well, this should help. The problem is that the testcase, when run, > SIGSEGVed, but since we're doing Ugly Things (VLAs with negative > size), it of course _can_ segfault, we're just relying that it > doesn't.
Suppossedly it might be better to split the main from the test into multiple functions, with __attribute__((noinline)) and just one invalid VLA in each. > diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c > b/gcc/testsuite/c-c++-common/ubsan/vla-1.c > index 3e47bd3..1c5d14a 100644 > --- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c > +++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c > @@ -13,7 +13,7 @@ main (void) > { > int x = -1; > double di = -3.2; > - V v = -666; > + V v = -6; > > int a[x]; > int aa[x][x]; > @@ -44,5 +44,5 @@ main (void) > /* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value 0(\n|\r\n|\r)" } */ > /* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value -1(\n|\r\n|\r)" } */ > /* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value -1(\n|\r\n|\r)" } */ > -/* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value -666(\n|\r\n|\r)" } */ > +/* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value -6(\n|\r\n|\r)" } */ > /* { dg-output "\[^\n\r]*variable length array bound evaluates to > non-positive value -42(\n|\r\n|\r)" } */ Jakub