From cdc6e2c50f96119bdc4c1205ff5901ca82ec8357 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Wed, 29 Jan 2020 18:17:43 -0600 Subject: add old compiler with ARM support --- .../testsuite/gcc.c-torture/execute/memcheck/t9.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 gcc_arm/testsuite/gcc.c-torture/execute/memcheck/t9.c (limited to 'gcc_arm/testsuite/gcc.c-torture/execute/memcheck/t9.c') diff --git a/gcc_arm/testsuite/gcc.c-torture/execute/memcheck/t9.c b/gcc_arm/testsuite/gcc.c-torture/execute/memcheck/t9.c new file mode 100755 index 0000000..f32ca01 --- /dev/null +++ b/gcc_arm/testsuite/gcc.c-torture/execute/memcheck/t9.c @@ -0,0 +1,40 @@ +/* Must define: + int expect_error; + void test (); + void setup () NOCHECK; */ + +#include "driver.h" + +int expect_error = 1; + +typedef struct { + short a; + char b; +} S1; +typedef struct { + struct { int x; S1 *s1p; } *p; +} S2; + +S1 *s1; +S2 *s2; + +void test () +{ + s1 = c_malloc (sizeof (S1)); + s2 = c_malloc (sizeof (S2)); + s2->p = c_malloc (sizeof (*s2->p)); + s2->p->s1p = s1; + s1->a = 47; + foo (); +} + +int foo () +{ + return s2->p->s1p->b; +} + +void setup () /* NOCHECK */ +{ + mark_region (&s1, sizeof (s1), ACCESS_RW); + mark_region (&s2, sizeof (s2), ACCESS_RW); +} -- cgit v1.2.3