From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../objc/execute/exceptions/local-variables-1.m | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 gcc/testsuite/objc/execute/exceptions/local-variables-1.m (limited to 'gcc/testsuite/objc/execute/exceptions/local-variables-1.m') diff --git a/gcc/testsuite/objc/execute/exceptions/local-variables-1.m b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m new file mode 100644 index 000000000..0488d792d --- /dev/null +++ b/gcc/testsuite/objc/execute/exceptions/local-variables-1.m @@ -0,0 +1,63 @@ +/* Check that local variables that get modified inside the @try + block survive until the @catch block is reached. */ +/* Developed by Ziemowit Laski . */ + +#include +#include +#import "../../../objc-obj-c++-shared/Object1.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 = [Object new]; + arg1 = 17; + arg2 = &gf2; + + @throw [Object new]; + } + @catch (Object *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; +} +#import "../../../objc-obj-c++-shared/Object1-implementation.h" -- cgit v1.2.3