OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libmudflap/] [testsuite/] [libmudflap.c/] [pass26-frag.c] - Blame information for rev 858

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 275 jeremybenn
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
int main ()
5
{
6
volatile int *p;
7
 
8
__mf_set_options ("-wipe-stack -no-check-initialization");
9
 
10
{
11
  volatile int array [10];
12
  p = & array[0];
13
 
14
  array[0] = 2;
15
  array[9] = 5;
16
 
17
  /* Array[] should be wiped clean at this point.  */
18
}
19
 
20
__mf_set_options ("-no-wipe-stack");
21
 
22
{
23
  volatile int array2[10];
24
 
25
 /* hope that this is allocated on top of old array[] */
26
  if (p != & array2[0])
27
    exit (0);  /* Test is not applicable. */
28
 
29
  array2[5] = 6;
30
 
31
  /* Old values shouldn't still be around; the new one should.  */
32
  if (p[0] == 2 || p[9] == 5 || p[5] != 6)
33
    abort() ;
34
 
35
  /* array2[] should not be wiped at this point! */
36
}
37
 
38
{
39
  volatile int array3[10];
40
 
41
 /* hope that this is allocated on top of old array[] and array2[]*/
42
  if (p != & array3[0])
43
    exit (0);  /* Test is not applicable. */
44
 
45
  array3[1] = 2;
46
 
47
  /* Check that old assignment is still around.  */
48
  if (p[5] != 6 || p[1] != 2)
49
    abort() ;
50
}
51
return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.