summaryrefslogtreecommitdiffstats
path: root/libacc
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-06-11 22:03:24 -0700
committerJack Palevich <jackpal@google.com>2009-06-11 22:03:24 -0700
commit61d22dc763af7c1528ddf8a30054015a9b299e73 (patch)
tree311f86e963d22e3ca0398440755b76876dd3a299 /libacc
parentb67b18f7c2217ae83e9ffc808cb9a58b233ec5bc (diff)
downloadsystem_core-61d22dc763af7c1528ddf8a30054015a9b299e73.zip
system_core-61d22dc763af7c1528ddf8a30054015a9b299e73.tar.gz
system_core-61d22dc763af7c1528ddf8a30054015a9b299e73.tar.bz2
Improve nested variable test.
Test that we can have two levels of local variables.
Diffstat (limited to 'libacc')
-rw-r--r--libacc/tests/data/locals.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libacc/tests/data/locals.c b/libacc/tests/data/locals.c
index 318162d..6982980 100644
--- a/libacc/tests/data/locals.c
+++ b/libacc/tests/data/locals.c
@@ -33,6 +33,20 @@ int b() {
printf("b()\n");
}
+int nested() {
+ int a;
+ printf("nested 0: a = %d\n", a);
+ a = 50;
+ printf("nested 1: a = %d\n", a);
+ {
+ int a;
+ printf("nested 2: a = %d\n", a);
+ a = 51;
+ printf("nested 3: a = %d\n", a);
+ }
+ printf("nested 4: a = %d\n", a);
+}
+
int main() {
globCheck();
fwdCheck();
@@ -45,5 +59,7 @@ int main() {
printf("main 3: a = %d\n", a);
h(30);
printf("main 4: a = %d\n", a);
+ nested();
+ printf("main 5: a = %d\n", a);
return 0;
}