diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm')
-rw-r--r-- | gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm new file mode 100644 index 000000000..73c7c9917 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/try-catch-9.mm @@ -0,0 +1,69 @@ +/* Check that local variables that get modified inside the @try + block survive until the @catch block is reached. */ +/* Developed by Ziemowit Laski <zlaski@apple.com>. */ + +/* { dg-do run } */ +/* { dg-xfail-run-if "PR23616" { *-*-* } { "-fgnu-runtime" } { "-fnext-runtime" } } */ +/* { dg-xfail-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" "-fgnu-runtime" } { "" } } +/* { dg-prune-output ".*internal compiler error.*" } */ +/* { dg-options "-fobjc-exceptions -O2" } */ + +#include "../objc-obj-c++-shared/TestsuiteObject.m" +#include <stdlib.h> +#include <stdio.h> + +int gi1 = 9, gi2 = 19; +float gf1 = 9.0, gf2 = 19.0; +id obj2 = nil; + +void foo (int arg1, float *arg2) +{ + int *pi = &gi1; + float *pf = &gf1; + id obj1 = nil; + int local1 = 45, local2 = 47; + float local3 = 3.0, local4 = 4.0; + register int local5 = 15; + static float local6 = 16.0; + + @try { + local1 = 123; + local2 = 345; + local3 = 5.0; + local4 = 6.0; + local5 = 17; + local6 = 18.0; + pi = &gi2; + pf = &gf2; + obj2 = obj1 = [TestsuiteObject new]; + arg1 = 17; + arg2 = &gf2; + + @throw [TestsuiteObject new]; + } + @catch (TestsuiteObject *obj) { + if (local1 != 123 || local2 != 345 || local3 != 5.0 + || local4 != 6.0 || local5 != 17 || local6 != 18.0) { + printf("Abort 1\n"); + abort(); + } + if (pi != &gi2 || pf != &gf2) { + printf("Abort 2\n"); + abort(); + } + if (!obj1 || obj1 != obj2) { + printf("Abort 3\n"); + abort(); + } + if (arg1 != 17 || arg2 != &gf2) { + printf("Abort 4\n"); + abort(); + } + } +} + +int main(void) { + foo(15, &gf1); + return 0; +} + |