re PR treelang/19896 ([treelang] Static variables don't work)
authorJames A. Morrison <phython@gcc.gnu.org>
Thu, 24 Feb 2005 16:24:25 +0000 (16:24 +0000)
committerJames A. Morrison <phython@gcc.gnu.org>
Thu, 24 Feb 2005 16:24:25 +0000 (16:24 +0000)
2005-02-24  James A. Morrison  <phython@gcc.gnu.org>

        PR other/19896
        * execute/execute.exp: New file.
        * execute/funccall.tree, execute/funccall-2.tree, execute/initial.tree,
        execute/main.tree, execute/static.tree: New tests.

From-SVN: r95504

gcc/testsuite/treelang/ChangeLog
gcc/testsuite/treelang/execute/execute.exp [new file with mode: 0644]
gcc/testsuite/treelang/execute/funccall-2.tree [new file with mode: 0644]
gcc/testsuite/treelang/execute/funccall.tree [new file with mode: 0644]
gcc/testsuite/treelang/execute/initial.tree [new file with mode: 0644]
gcc/testsuite/treelang/execute/main.tree [new file with mode: 0644]
gcc/testsuite/treelang/execute/static.tree [new file with mode: 0644]

index 13021aa..59db353 100644 (file)
@@ -1,5 +1,12 @@
 2005-02-24  James A. Morrison  <phython@gcc.gnu.org>
 
+       PR other/19896
+        * execute/execute.exp: New file.
+        * execute/funccall.tree, execute/funccall-2.tree, execute/initial.tree,
+        execute/main.tree, execute/static.tree: New tests.
+
+2005-02-24  James A. Morrison  <phython@gcc.gnu.org>
+
        PR other/19897
        * compile/exit.tree, compile/extref.tree, compile/function-1.tree,
        compile/syntax-1.tree: New tests.
diff --git a/gcc/testsuite/treelang/execute/execute.exp b/gcc/testsuite/treelang/execute/execute.exp
new file mode 100644 (file)
index 0000000..836c325
--- /dev/null
@@ -0,0 +1,31 @@
+# Tests for treelang; run from gcc/treelang/Make-lang.in => gcc/Makefile
+
+# Copyright (C) 2004 by The Free Software Foundation
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+# In other words, you are welcome to use, share and improve this program.
+# You are forbidden to forbid anyone else to use, share and improve
+# what you give them.   Help stamp out software-hoarding!
+
+# Treelang tests that only need to compile.
+
+# Load support procs.
+load_lib treelang-dg.exp
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.tree]] "" ""
+dg-finish
diff --git a/gcc/testsuite/treelang/execute/funccall-2.tree b/gcc/testsuite/treelang/execute/funccall-2.tree
new file mode 100644 (file)
index 0000000..43911c9
--- /dev/null
@@ -0,0 +1,28 @@
+// { dg-do run }
+external_definition int main (int argc);
+
+static int foo (int bba);
+
+foo
+{
+       automatic int bar;
+
+       bar = bba + +1;
+       return bar;
+}
+
+main
+{
+  automatic int aaa = +3;
+
+  aaa = foo (argc);
+  
+  if (aaa == +2)
+    { 
+      return +0;
+    }
+  else
+    {
+      return +1;
+    }
+}
diff --git a/gcc/testsuite/treelang/execute/funccall.tree b/gcc/testsuite/treelang/execute/funccall.tree
new file mode 100644 (file)
index 0000000..e806d3b
--- /dev/null
@@ -0,0 +1,33 @@
+// { dg-do run }
+// Tests whether initializtion works properly.
+external_reference void abort ();
+external_reference void exit (int code);
+external_definition int main ();
+
+static int foo ();
+
+foo
+{
+       automatic int bar;
+
+       bar = +1;
+       bar = bar + +1;
+       return bar;
+}
+
+main
+{
+  automatic int aaa;
+
+  aaa = foo ();
+  
+  if (aaa == +2)
+    { 
+      exit (0);
+    }
+  else
+    {
+      abort ();
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/treelang/execute/initial.tree b/gcc/testsuite/treelang/execute/initial.tree
new file mode 100644 (file)
index 0000000..0daa997
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-do run }
+// Tests whether initializtion works properly.
+external_reference void abort ();
+external_reference void exit (int code);
+external_definition int main ();
+
+main
+{
+  automatic int aaa = +3;
+
+  if (aaa == +3)
+    { 
+      exit (0);
+    }
+  else
+    {
+      abort ();
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/treelang/execute/main.tree b/gcc/testsuite/treelang/execute/main.tree
new file mode 100644 (file)
index 0000000..549f991
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-do run }
+external_definition int main (int argc);
+
+main
+{
+       if (argc == 1)
+       {
+               return 0;
+       }
+       else
+       {
+               return argc;
+       }
+}
diff --git a/gcc/testsuite/treelang/execute/static.tree b/gcc/testsuite/treelang/execute/static.tree
new file mode 100644 (file)
index 0000000..370f244
--- /dev/null
@@ -0,0 +1,32 @@
+// { dg-do run }
+external_reference void abort ();
+external_reference void exit (int code);
+external_definition int main (int argc, int argv);
+
+static int foo ();
+
+foo
+{
+       static int bar = +1;
+
+       bar = bar + +1;
+       return bar;
+}
+
+main
+{
+  automatic int aaa = +3;
+
+  aaa = foo ();
+  aaa = foo ();
+  
+  if (aaa == 3)
+    { 
+      exit (0);
+    }
+  else
+    {
+      abort ();
+    }
+  return 0;
+}