aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/memcheck/t4.c
blob: 25010a068184fed0071e88b9d6143f56024ccf50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Must define:
   int expect_error;
   void test ();
   void setup () NOCHECK; */

#include "driver.h"

int expect_error = 0;

struct s {
  char c;
  int a, b;
};

struct s *sp;

void test ()
{
  sp = c_malloc (sizeof (struct s));
  sp->c = 0;
  sp->a = 12;
  sp->b = 47;
  foo (sp);
}

int foo (struct s *sp)
{
  return sp->c + sp->a + sp->b;
}

void setup () /* NOCHECK */
{
  mark_region (&sp, sizeof (sp), ACCESS_RW);
}