]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bounds-2.c (fn4): Adjust to check the array size in the structure.
authorMarek Polacek <polacek@redhat.com>
Wed, 23 Jul 2014 13:24:14 +0000 (13:24 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 23 Jul 2014 13:24:14 +0000 (13:24 +0000)
* c-c++-common/ubsan/bounds-2.c (fn4): Adjust to check the array size
in the structure.

From-SVN: r212933

gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/bounds-2.c

index 1ef656362e220ea61242ff71b8f334312923d8e8..947cded3c2bc6cfa3a5371ddbecc242965ff0d6e 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-23  Marek Polacek  <polacek@redhat.com>
+
+       * c-c++-common/ubsan/bounds-2.c (fn4): Adjust to check the array size
+       in the structure. 
+
 2014-07-23  Jiong Wang  <jiong.wang@arm.com>
 
        * gcc.dg/ira-shrinkwrap-prep-1.c (target): Add arm_nothumb.
index 812e0db3edf763635b89ec759456f2199b67030e..10642c7a16ee32263b58e9b619b29a0d7bed430e 100644 (file)
@@ -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))