File tree Expand file tree Collapse file tree 8 files changed +115
-0
lines changed
goto-cc-regression-gh-issue-5380 Expand file tree Collapse file tree 8 files changed +115
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ add_subdirectory(contracts)
55
55
add_subdirectory (goto-harness )
56
56
add_subdirectory (goto-harness-multi-file-project )
57
57
add_subdirectory (goto-cc-file-local )
58
+ add_subdirectory (goto-cc-regression-gh-issue-5380 )
58
59
add_subdirectory (linking-goto-binaries )
59
60
add_subdirectory (symtab2gb )
60
61
add_subdirectory (validate-trace-xml-schema )
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ DIRS = cbmc \
28
28
systemc \
29
29
contracts \
30
30
goto-cc-file-local \
31
+ goto-cc-regression-gh-issue-5380 \
31
32
linking-goto-binaries \
32
33
symtab2gb \
33
34
solver-hardness \
Original file line number Diff line number Diff line change
1
+ if (WIN32 )
2
+ set (is_windows true )
3
+ else ()
4
+ set (is_windows false )
5
+ endif ()
6
+
7
+ add_test_pl_tests (
8
+ "${CMAKE_CURRENT_SOURCE_DIR} /chain.sh $<TARGET_FILE:goto-cc> ${is_windows} "
9
+ )
Original file line number Diff line number Diff line change
1
+ default : test.log
2
+
3
+ include ../../src/config.inc
4
+ include ../../src/common
5
+
6
+ ifeq ($(BUILD_ENV_ ) ,MSVC)
7
+ exe=../../../src/goto-cc/goto-cl
8
+ is_windows=true
9
+ else
10
+ exe=../../../src/goto-cc/goto-cc
11
+ is_windows=false
12
+ endif
13
+
14
+ test :
15
+ @../test.pl -e -p -c ' ../chain.sh $(exe) $(is_windows)'
16
+
17
+ tests.log :
18
+ @../test.pl -e -p -c ' ../chain.sh $(exe) $(is_windows)'
19
+
20
+ show :
21
+ @for dir in * ; do
22
+ if [ -d " $$ dir" ]; then \
23
+ vim -o " $$ dir/*.c" " $$ dir/*.out" ; \
24
+ fi ; \
25
+ done ;
26
+
27
+ clean :
28
+ @for dir in * ; do
29
+ $(RM ) tests.log; \
30
+ if [ -d " $$ dir" ]; then \
31
+ cd " $$ dir" ; \
32
+ $(RM ) * .out * .gb; \
33
+ cd ..; \
34
+ fi ; \
35
+ done ;
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ #
3
+ # This particular file and chain.sh make sure that a particular
4
+ # file is passed twice to goto-cc, causing a crash under some
5
+ # specific name mangling configuration.
6
+ #
7
+ # Author: Fotis Koutoulakis [email protected]
8
+
9
+ set -e # cause the script to immediately exit when it errors
10
+
11
+ goto_cc=$1
12
+ is_windows=$2
13
+
14
+ # collect compilation files
15
+ PROBLEM_SRC=" test.c"
16
+ MAIN_SRC=" main.c"
17
+
18
+ echo " source files are ${SRC} "
19
+
20
+ MAIN_OUTFILE=" main.gb"
21
+ PROBLEM_OUTFILE=" test.gb"
22
+
23
+ # first drive: compile the problematic file into a gb
24
+ if [[ " ${is_windows} " == " true" ]]; then
25
+ " ${goto_cc} " --export-file-local-symbols " ${PROBLEM_SRC} " /Fe" ${PROBLEM_OUTFILE} "
26
+ else
27
+ " ${goto_cc} " --export-file-local-symbols " ${PROBLEM_SRC} " -o " ${PROBLEM_OUTFILE} "
28
+ fi
29
+
30
+ # second drive: compile and link the main source, problematic source and problematic
31
+ # binary - note: the double inclusion of a similar artifact (source and binary) is
32
+ # by design, to test a regression in goto-cc
33
+ " ${goto_cc} " --export-file-local-symbols " ${PROBLEM_SRC} " " ${MAIN_SRC} " " ${PROBLEM_OUTFILE} "
Original file line number Diff line number Diff line change
1
+ static inline int foo ()
2
+ {
3
+ return 42 ;
4
+ }
5
+
6
+ int bar ()
7
+ {
8
+ return foo ();
9
+ }
Original file line number Diff line number Diff line change
1
+ static inline int foo ()
2
+ {
3
+ return 42 ;
4
+ }
5
+
6
+ int bar ();
7
+
8
+ int test ()
9
+ {
10
+ return foo () + bar ();
11
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ test.c
3
+ --export-function-local-symbols
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^warning: ignoring
8
+ ^Invariant check failed$
9
+ --
10
+ This test guards against a regression added when the local file
11
+ name mangler would not add the required name into the symbol
12
+ table. When the regression was present, we were met with an
13
+ invariant violation during goto-cc compilation. Without it,
14
+ nothing spectacular happens - compilation proceeds as expected.
15
+ For more information look up issue 5380 in github.com/diffblue/cbmc.
16
+
You can’t perform that action at this time.
0 commit comments