From 31e1324bf938185c988381f9936607ed647ed064 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 23 Jul 2014 13:24:14 +0000 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/ubsan/bounds-2.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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)) -- 2.47.3