Skip to content

Commit f4a9746

Browse files
committed
Fix builtin function return hidden flag inconsistency
Function returns for built-in functions now correctly match their function call hidden flag. This is done by symex storing the combined hidden flag in call frame. Co-authored-by: Kiro autonomous agent Fixes: #5207
1 parent 76dd20f commit f4a9746

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
int main()
5+
{
6+
char *x = malloc(1);
7+
assert(0);
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
--json-ui
4+
activate-multi-line-match
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
"stepType": "function-call",[^}]*"hidden": false[^}]*"function":[^}]*"displayName": "malloc"
8+
"stepType": "function-return",[^}]*"hidden": false[^}]*"function":[^}]*"displayName": "malloc"
9+
--
10+
^warning: ignoring
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
test.c
3+
--xml-ui
4+
activate-multi-line-match
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
<function_call hidden="false" step_nr="\d+" thread="0">\n\s*<function display_name="malloc" identifier="malloc"
8+
<function_return hidden="false" step_nr="\d+" thread="0">\n\s*<function display_name="malloc" identifier="malloc"
9+
--
10+
^warning: ignoring

src/goto-symex/symex_function_call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void goto_symext::symex_function_call_post_clean(
344344
frame.call_lhs = cleaned_lhs;
345345
frame.end_of_function = --goto_function.body.instructions.end();
346346
frame.function_identifier=identifier;
347-
frame.hidden_function = goto_function.is_hidden();
347+
frame.hidden_function = hidden;
348348

349349
// set up the 'return value symbol' when needed
350350
if(frame.call_lhs.is_not_nil())

0 commit comments

Comments
 (0)