diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-09-06 16:02:48 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-09-06 16:02:48 +0000 |
commit | c06c96201c375be53db27819d3b4e61305ceecaf (patch) | |
tree | 50fd05e293c09b23e467bd2a5aa3e04c58289b51 | |
parent | ac16ec28908325919c5182c1c9f1f42a4ce07030 (diff) | |
download | cflow-c06c96201c375be53db27819d3b4e61305ceecaf.tar.gz cflow-c06c96201c375be53db27819d3b4e61305ceecaf.tar.bz2 |
Add new testcase
-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 @@ -32,41 +32,42 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ } >$(srcdir)/package.m4 # ## ------------ ## ## Test suite. ## ## ------------ ## 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 AUTOTEST = $(AUTOM4TE) --language=autotest $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp mv $@.tmp $@ atconfig: $(top_builddir)/config.status cd $(top_builddir) && ./config.status tests/$@ clean-local: 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 @@ -48,22 +48,23 @@ AT_INIT CFLOW_TEST_INIT AT_TESTED([cflow]) m4_include([version.at]) m4_include([direct.at]) m4_include([reverse.at]) m4_include([recurse.at]) 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]) m4_include([parm.at]) m4_include([nfparg.at]) m4_include([nfarg.at]) m4_include([hiding.at]) m4_include([multi.at]) # End of testsuite.at |