Skip to content

Commit 41042e2

Browse files
authored
Merge pull request #4550 from diffblue/fix_replace_return
Fix replace_return
2 parents 0b4a3e8 + 1d76fea commit 41042e2

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
inline int *foo()
2+
{
3+
int dummy;
4+
int *ptr = &dummy;
5+
return ptr;
6+
}
7+
8+
int main()
9+
{
10+
int *ptr = foo();
11+
*ptr = 42;
12+
return 0;
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--inline --pointer-check
4+
dereference failure: dead object in \*ptr: FAILURE$
5+
^VERIFICATION FAILED$
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring

src/goto-programs/goto_inline_class.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,11 @@ void goto_inlinet::replace_return(
165165
lhs,
166166
typecast_exprt::conditional_cast(it->return_value(), lhs.type()));
167167
it->type=ASSIGN;
168-
169-
it++;
170168
}
171169
else
172170
{
173171
it->code_nonconst() = code_expressiont(it->return_value());
174172
it->type=OTHER;
175-
it++;
176173
}
177174
}
178175
}

0 commit comments

Comments
 (0)