Skip to content

Commit c6f83a2

Browse files
authored
Merge pull request #6847 from Herbping/convert_side_effect_with_variable_names
associate variables' names to tmp_post
2 parents c688efd + b1f440a commit c6f83a2

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <assert.h>
2+
3+
int main(int argc, char **argv)
4+
{
5+
char *ptr;
6+
ptr = malloc(2);
7+
ptr += 2;
8+
char c = *ptr++;
9+
return 0;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--pointer-check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[main\.pointer_dereference\.5\] line 8 dereference failure: pointer outside object bounds in \*tmp_post_ptr: FAILURE
7+
\*\* 1 of [0-9]* failed
8+
^VERIFICATION FAILED$
9+
--
10+
^warning: ignoring

src/goto-programs/goto_convert_side_effect.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,14 @@ void goto_convertt::remove_post(
314314
if(result_is_used)
315315
{
316316
exprt tmp = op;
317-
make_temp_symbol(tmp, "post", dest, mode);
317+
std::string suffix = "post";
318+
if(auto sym_expr = expr_try_dynamic_cast<symbol_exprt>(tmp))
319+
{
320+
const irep_idt &base_name = ns.lookup(*sym_expr).base_name;
321+
suffix += "_" + id2string(base_name);
322+
}
323+
324+
make_temp_symbol(tmp, suffix, dest, mode);
318325
expr.swap(tmp);
319326
}
320327
else

0 commit comments

Comments
 (0)