diff options
author | Marek Polacek <polacek@redhat.com> | 2014-07-23 13:24:14 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-07-23 13:24:14 +0000 |
commit | 31e1324bf938185c988381f9936607ed647ed064 (patch) | |
tree | 32e9906c24bf15d561eed5f9acd64616671b2a64 /gcc | |
parent | b50a9d38941a6a3aa42b9a9e89c5bf5dfb509ed1 (diff) | |
download | gcc-31e1324bf938185c988381f9936607ed647ed064.zip gcc-31e1324bf938185c988381f9936607ed647ed064.tar.gz gcc-31e1324bf938185c988381f9936607ed647ed064.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | 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 1ef6563..947cded 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/c-c++-common/ubsan/bounds-2.c b/gcc/testsuite/c-c++-common/ubsan/bounds-2.c index 812e0db..10642c7 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)) |