From: Marek Polacek Date: Wed, 23 Jul 2014 13:24:14 +0000 (+0000) Subject: bounds-2.c (fn4): Adjust to check the array size in the structure. X-Git-Tag: releases/gcc-5.1.0~6151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31e1324bf938185c988381f9936607ed647ed064;p=thirdparty%2Fgcc.git bounds-2.c (fn4): Adjust to check the array size in the structure. * c-c++-common/ubsan/bounds-2.c (fn4): Adjust to check the array size in the structure. From-SVN: r212933 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ef656362e22..947cded3c2bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-23 Marek Polacek + + * c-c++-common/ubsan/bounds-2.c (fn4): Adjust to check the array size + in the structure. + 2014-07-23 Jiong Wang * gcc.dg/ira-shrinkwrap-prep-1.c (target): Add arm_nothumb. diff --git a/gcc/testsuite/c-c++-common/ubsan/bounds-2.c b/gcc/testsuite/c-c++-common/ubsan/bounds-2.c index 812e0db3edf7..10642c7a16ee 100644 --- a/gcc/testsuite/c-c++-common/ubsan/bounds-2.c +++ b/gcc/testsuite/c-c++-common/ubsan/bounds-2.c @@ -4,6 +4,7 @@ /* Test runtime errors. */ struct S { int a[10]; }; +struct T { int a[5]; int s[2]; }; int foo_5 (void) @@ -47,8 +48,9 @@ fn3 (void) static void __attribute__ ((noinline, noclone)) fn4 (void) { - volatile int a[5]; - a[foo_5 ()] = 1; + struct T t; + asm ("" : : "r" (&t.a) : "memory"); + t.a[foo_5 ()] = 1; } static void __attribute__ ((noinline, noclone))