diff options
-rw-r--r-- | tests/Makefile.am | 25 | ||||
-rw-r--r-- | tests/static.at | 63 | ||||
-rw-r--r-- | tests/testsuite.at | 1 |
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 | ||
43 | TESTSUITE_AT = \ | 43 | TESTSUITE_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 | ||
62 | TESTSUITE = $(srcdir)/testsuite | 63 | TESTSUITE = $(srcdir)/testsuite |
63 | 64 | ||
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 @@ | |||
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 | |||
19 | AT_SETUP([Static symbols with forward decls and -i^s]) | ||
20 | AT_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 | |||
39 | AT_DATA([prog],[ | ||
40 | static void foo(); | ||
41 | |||
42 | int | ||
43 | bar() | ||
44 | { | ||
45 | foo(); | ||
46 | } | ||
47 | |||
48 | static void | ||
49 | foo() | ||
50 | { | ||
51 | int x = 1; | ||
52 | } | ||
53 | ]) | ||
54 | |||
55 | AT_DATA([2],[ | ||
56 | ]) | ||
57 | |||
58 | CFLOW_OPT([-i^s],[ | ||
59 | CFLOW_CHECK_PROG([prog 2], | ||
60 | [bar() <int bar () at prog:5>:]) | ||
61 | ]) | ||
62 | |||
63 | 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]) | |||
57 | m4_include([awrapper.at]) | 57 | m4_include([awrapper.at]) |
58 | m4_include([pwrapper.at]) | 58 | m4_include([pwrapper.at]) |
59 | m4_include([fdecl.at]) | 59 | m4_include([fdecl.at]) |
60 | m4_include([static.at]) | ||
60 | m4_include([include.at]) | 61 | m4_include([include.at]) |
61 | m4_include([ssblock.at]) | 62 | m4_include([ssblock.at]) |
62 | m4_include([funcarg.at]) | 63 | m4_include([funcarg.at]) |