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
This commit is contained in:
James A. Morrison 2005-02-24 16:24:25 +00:00
parent fb26d54d7e
commit f836d6e475
7 changed files with 165 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,14 @@
// { dg-do run }
external_definition int main (int argc);
main
{
if (argc == 1)
{
return 0;
}
else
{
return argc;
}
}

View File

@ -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;
}