aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am25
-rw-r--r--tests/static.at63
-rw-r--r--tests/testsuite.at1
3 files changed, 77 insertions, 12 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a70023a..e22a2b4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,23 +41,24 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
## ------------ ##
TESTSUITE_AT = \
- testsuite.at\
- version.at\
- direct.at\
- reverse.at\
- recurse.at\
attr.at\
awrapper.at\
- pwrapper.at\
+ direct.at\
fdecl.at\
- include.at\
- ssblock.at\
funcarg.at\
- parm.at\
- nfparg.at\
- nfarg.at\
hiding.at\
- multi.at
+ include.at\
+ multi.at\
+ nfarg.at\
+ nfparg.at\
+ parm.at\
+ pwrapper.at\
+ recurse.at\
+ reverse.at\
+ ssblock.at\
+ static.at\
+ testsuite.at\
+ version.at
TESTSUITE = $(srcdir)/testsuite
diff --git a/tests/static.at b/tests/static.at
new file mode 100644
index 0000000..073719b
--- /dev/null
+++ b/tests/static.at
@@ -0,0 +1,63 @@
+# This file is part of GNU cflow testsuite. -*- Autotest -*-
+# Copyright (C) 2006 Sergey Poznyakoff
+#
+# 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+AT_SETUP([Static symbols with forward decls and -i^s])
+AT_KEYWORDS([static fdecl])
+
+# Up to version 1.1 static symbols with forward declarations caused
+# segmentation faults when used with -i^s.
+#
+# Synopsis: Normally static functions are not added to callee lists
+# of their callers in -i^s mode (see add_reference() and call() in parser.c),
+# therefore cflow 1.1 assumed it was safe to free them in static_processor().
+# However, there is an important exception: if the function storage type is
+# not known at the time of reference. Such functions are added to callee lists
+# and freeing them causes coredumps.
+#
+# To reproduce the case we need two source files: first with the actual test
+# program and the second, empty, one, whose purpose is to trigger additional
+# memory allocations after symbol deletion.
+#
+# Reported by: Laurent Fournie
+# References: <OFA772D453.E40E7252-ONC12571D8.0046430B-C12571D8.004B043A@rockwellcollins.com>
+
+AT_DATA([prog],[
+static void foo();
+
+int
+bar()
+{
+ foo();
+}
+
+static void
+foo()
+{
+ int x = 1;
+}
+])
+
+AT_DATA([2],[
+])
+
+CFLOW_OPT([-i^s],[
+CFLOW_CHECK_PROG([prog 2],
+[bar() <int bar () at prog:5>:])
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 55fda15..a65f8a4 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -57,6 +57,7 @@ m4_include([attr.at])
m4_include([awrapper.at])
m4_include([pwrapper.at])
m4_include([fdecl.at])
+m4_include([static.at])
m4_include([include.at])
m4_include([ssblock.at])
m4_include([funcarg.at])

Return to:

Send suggestions and report system problems to the System administrator.