diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-02-24 16:24:25 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-02-24 16:24:25 +0000 |
commit | f836d6e475e2ee111825b8ef9a62366ff32cd44a (patch) | |
tree | 56dcc3a4f2b154b40a214d2d0317fb5bbd996648 /gcc/testsuite | |
parent | fb26d54d7eac86fb8086904e2530bbe6e78e5db2 (diff) | |
download | gcc-f836d6e475e2ee111825b8ef9a62366ff32cd44a.zip gcc-f836d6e475e2ee111825b8ef9a62366ff32cd44a.tar.gz gcc-f836d6e475e2ee111825b8ef9a62366ff32cd44a.tar.bz2 |
re PR treelang/19896 ([treelang] Static variables don't work)
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
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/treelang/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/execute.exp | 31 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/funccall-2.tree | 28 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/funccall.tree | 33 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/initial.tree | 20 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/main.tree | 14 | ||||
-rw-r--r-- | gcc/testsuite/treelang/execute/static.tree | 32 |
7 files changed, 165 insertions, 0 deletions
diff --git a/gcc/testsuite/treelang/ChangeLog b/gcc/testsuite/treelang/ChangeLog index 13021aa..59db353 100644 --- a/gcc/testsuite/treelang/ChangeLog +++ b/gcc/testsuite/treelang/ChangeLog @@ -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 index 0000000..836c325 --- /dev/null +++ b/gcc/testsuite/treelang/execute/execute.exp @@ -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 index 0000000..43911c9 --- /dev/null +++ b/gcc/testsuite/treelang/execute/funccall-2.tree @@ -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 index 0000000..e806d3b --- /dev/null +++ b/gcc/testsuite/treelang/execute/funccall.tree @@ -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 index 0000000..0daa997 --- /dev/null +++ b/gcc/testsuite/treelang/execute/initial.tree @@ -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 index 0000000..549f991 --- /dev/null +++ b/gcc/testsuite/treelang/execute/main.tree @@ -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 index 0000000..370f244 --- /dev/null +++ b/gcc/testsuite/treelang/execute/static.tree @@ -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; +} |