Skip to content

Commit 671193c

Browse files
authored
Merge pull request #960 from pkesseli/bugfix/main-and-args-not-internal
Avoid marking main function call / arguments as internal
2 parents c07cdf9 + 37c0a36 commit 671193c

File tree

7 files changed

+50
-1
lines changed

7 files changed

+50
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.diffblue.javatest.nestedobjects.subpackage;
2+
3+
public class Item {
4+
public int cost;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.diffblue.javatest.nestedobjects.subpackage;
2+
3+
public class Order {
4+
public Item item;
5+
6+
/**
7+
* Checks if this order has an item.
8+
*/
9+
public boolean hasItem() {
10+
if (item == null) {
11+
return false;
12+
} else {
13+
return true;
14+
}
15+
}
16+
17+
/**
18+
* Sets the item for this order.
19+
*/
20+
public boolean setItem(Item item) {
21+
boolean exists = hasItem();
22+
this.item = item;
23+
return exists;
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Source of benchmark:
2+
https://github.com/DiffBlue-benchmarks/java-test
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
com/diffblue/javatest/nestedobjects/subpackage/Order.class
3+
--json-ui --function 'com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:(Lcom/diffblue/javatest/nestedobjects/subpackage/Item;)Z' --cover location --trace
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
"identifier": "__CPROVER_initialize",\n *"sourceLocation": [{][}]\n *[}],\n *"hidden": false,\n *"internal": true,\n *"stepType": "function-call",
8+
"internal": true,\n *"lhs": "tmp_object_factory[$][0-9]+",
9+
"internal": false,\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z",\n *"line": "21"\n *[}],\n *"stepType": "function-call",
10+
"internal": false,\n *"lhs": "this",\n *"mode": "java",\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z",
11+
"internal": false,\n *"lhs": "item",\n *"mode": "java",\n *"sourceLocation": [{]\n *"file": "com/diffblue/javatest/nestedobjects/subpackage/Order.java",\n *"function": "java::com.diffblue.javatest.nestedobjects.subpackage.Order.setItem:[(]Lcom/diffblue/javatest/nestedobjects/subpackage/Item;[)]Z",
12+
--
13+
^warning: ignoring

src/goto-symex/build_goto_trace.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ void update_internal_field(
206206
// set internal field to _start function-return step
207207
if(SSA_step.source.pc->function==goto_functionst::entry_point())
208208
{
209-
goto_trace_step.internal=true;
209+
// "__CPROVER_*" function calls in __CPROVER_start are already marked as
210+
// internal. Don't mark any other function calls (i.e. "main"), function
211+
// arguments or any other parts of a code_function_callt as internal.
212+
if(SSA_step.source.pc->code.get_statement()!=ID_function_call)
213+
goto_trace_step.internal=true;
210214
}
211215
}
212216

0 commit comments

Comments
 (0)