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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [obj-c++.dg/] [try-catch-9.mm] - Blame information for rev 823

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

Line No. Rev Author Line
1 149 jeremybenn
/* Check that local variables that get modified inside the @try
2
   block survive until the @catch block is reached.  */
3
/* Developed by Ziemowit Laski .  */
4
 
5
/* { dg-options "-fobjc-exceptions -O2" } */
6
/* { dg-do run } */
7
 
8
#include 
9
#include 
10
#include 
11
 
12
int gi1 = 9, gi2 = 19;
13
float gf1 = 9.0, gf2 = 19.0;
14
id obj2 = nil;
15
 
16
void foo (int arg1, float *arg2)
17
{
18
  int *pi = &gi1;
19
  float *pf = &gf1;
20
  id obj1 = nil;
21
  int local1 = 45, local2 = 47;
22
  float local3 = 3.0, local4 = 4.0;
23
  register int local5 = 15;
24
  static float local6 = 16.0;
25
 
26
  @try {
27
    local1 = 123;
28
    local2 = 345;
29
    local3 = 5.0;
30
    local4 = 6.0;
31
    local5 = 17;
32
    local6 = 18.0;
33
    pi = &gi2;
34
    pf = &gf2;
35
    obj2 = obj1 = [Object new];
36
    arg1 = 17;
37
    arg2 = &gf2;
38
 
39
    @throw [Object new];
40
  }
41
  @catch (Object *obj) {
42
   if (local1 != 123 || local2 != 345 || local3 != 5.0
43
       || local4 != 6.0 || local5 != 17 || local6 != 18.0) {
44
     printf("Abort 1\n");
45
     abort();
46
   }
47
   if (pi != &gi2 || pf != &gf2) {
48
     printf("Abort 2\n");
49
     abort();
50
   }
51
   if (!obj1 || obj1 != obj2) {
52
     printf("Abort 3\n");
53
     abort();
54
   }
55
   if (arg1 != 17 || arg2 != &gf2) {
56
     printf("Abort 4\n");
57
     abort();
58
   }
59
  }
60
}
61
 
62
int main(void) {
63
  foo(15, &gf1);
64
  return 0;
65
}

powered by: WebSVN 2.1.0

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