Skip to content

Commit 3a4e48c

Browse files
committed
Run cbmc c++ regression as part of default regression test
Set is_parameter for c++ function parameter symbol
1 parent c0ce9de commit 3a4e48c

File tree

7 files changed

+52
-1
lines changed

7 files changed

+52
-1
lines changed

regression/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
DIRS = ansi-c \
22
cbmc \
33
cbmc-cover \
4+
cbmc-cpp \
45
cbmc-java \
56
cbmc-java-inheritance \
67
cpp \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
int x;
3+
4+
void g(int i){
5+
x=i;
6+
}
7+
8+
int main() {
9+
g(3);
10+
assert(x==3);
11+
}
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.cpp
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
unsigned x;
3+
4+
class ct {
5+
void f(int i) {
6+
x=x+i;
7+
}
8+
};
9+
10+
int main() {
11+
unsigned r;
12+
x=r%3;
13+
ct c;
14+
c.f(2);
15+
assert(x<4);
16+
assert(x<5);
17+
}
18+
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.cpp
3+
4+
instance is SATISFIABLE$
5+
instance is UNSATISFIABLE$
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
^VERIFICATION FAILED$
9+
--
10+
^warning: ignoring

regression/cbmc-cpp/union2/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <assert.h>
12
struct A
23
{
34
union

src/cpp/cpp_typecheck_function.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ void cpp_typecheckt::convert_parameter(
4444
symbol.type=parameter.type();
4545
symbol.is_state_var=true;
4646
symbol.is_lvalue=!is_reference(symbol.type);
47+
symbol.is_parameter=true;
4748

48-
assert(!symbol.base_name.empty());
49+
INVARIANT(!symbol.base_name.empty(), "parameter has base name");
4950

5051
symbolt *new_symbol;
5152

0 commit comments

Comments
 (0)