summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2006-09-06 16:02:48 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2006-09-06 16:02:48 (GMT)
commitc06c96201c375be53db27819d3b4e61305ceecaf (patch) (unidiff)
tree50fd05e293c09b23e467bd2a5aa3e04c58289b51
parentac16ec28908325919c5182c1c9f1f42a4ce07030 (diff)
downloadcflow-c06c96201c375be53db27819d3b4e61305ceecaf.tar.gz
cflow-c06c96201c375be53db27819d3b4e61305ceecaf.tar.bz2
Add new testcase
Diffstat (more/less context) (ignore whitespace changes)
-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
41## ------------ ## 41## ------------ ##
42 42
43TESTSUITE_AT = \ 43TESTSUITE_AT = \
44 testsuite.at\
45 version.at\
46 direct.at\
47 reverse.at\
48 recurse.at\
49 attr.at\ 44 attr.at\
50 awrapper.at\ 45 awrapper.at\
51 pwrapper.at\ 46 direct.at\
52 fdecl.at\ 47 fdecl.at\
53 include.at\
54 ssblock.at\
55 funcarg.at\ 48 funcarg.at\
56 parm.at\
57 nfparg.at\
58 nfarg.at\
59 hiding.at\ 49 hiding.at\
60 multi.at 50 include.at\
51 multi.at\
52 nfarg.at\
53 nfparg.at\
54 parm.at\
55 pwrapper.at\
56 recurse.at\
57 reverse.at\
58 ssblock.at\
59 static.at\
60 testsuite.at\
61 version.at
61 62
62TESTSUITE = $(srcdir)/testsuite 63TESTSUITE = $(srcdir)/testsuite
63 64
diff --git a/tests/static.at b/tests/static.at
new file mode 100644
index 0000000..073719b
--- a/dev/null
+++ b/tests/static.at
@@ -0,0 +1,63 @@
1# This file is part of GNU cflow testsuite. -*- Autotest -*-
2# Copyright (C) 2006 Sergey Poznyakoff
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as
6# published by the Free Software Foundation; either version 2, or (at
7# your option) any later version.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17# 02110-1301 USA.
18
19AT_SETUP([Static symbols with forward decls and -i^s])
20AT_KEYWORDS([static fdecl])
21
22# Up to version 1.1 static symbols with forward declarations caused
23# segmentation faults when used with -i^s.
24#
25# Synopsis: Normally static functions are not added to callee lists
26# of their callers in -i^s mode (see add_reference() and call() in parser.c),
27# therefore cflow 1.1 assumed it was safe to free them in static_processor().
28# However, there is an important exception: if the function storage type is
29# not known at the time of reference. Such functions are added to callee lists
30# and freeing them causes coredumps.
31#
32# To reproduce the case we need two source files: first with the actual test
33# program and the second, empty, one, whose purpose is to trigger additional
34# memory allocations after symbol deletion.
35#
36# Reported by: Laurent Fournie
37# References: <OFA772D453.E40E7252-ONC12571D8.0046430B-C12571D8.004B043A@rockwellcollins.com>
38
39AT_DATA([prog],[
40static void foo();
41
42int
43bar()
44{
45 foo();
46}
47
48static void
49foo()
50{
51 int x = 1;
52}
53])
54
55AT_DATA([2],[
56])
57
58CFLOW_OPT([-i^s],[
59CFLOW_CHECK_PROG([prog 2],
60[bar() <int bar () at prog:5>:])
61])
62
63AT_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])
57m4_include([awrapper.at]) 57m4_include([awrapper.at])
58m4_include([pwrapper.at]) 58m4_include([pwrapper.at])
59m4_include([fdecl.at]) 59m4_include([fdecl.at])
60m4_include([static.at])
60m4_include([include.at]) 61m4_include([include.at])
61m4_include([ssblock.at]) 62m4_include([ssblock.at])
62m4_include([funcarg.at]) 63m4_include([funcarg.at])

Return to:

Send suggestions and report system problems to the System administrator.