Skip to content

Commit 177af32

Browse files
committed
Fix reference to temporary that has gone out of scope
Although the temporary is bound by a const reference, that reference is then just passed on to subobject initialisers. Per https://en.cppreference.com/w/cpp/language/reference_initialization.html#Lifetime_of_a_temporary, "passing on" does not extend the lifetime of a temporary. Try working around asan
1 parent d4738d4 commit 177af32

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

unit/goto-symex/goto_symex_state.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ SCENARIO(
3838
auto fresh_name = [&fresh_name_count](const irep_idt &) {
3939
return fresh_name_count++;
4040
};
41+
const irep_idt empty_language_mode;
4142
goto_symex_statet state{
4243
source,
4344
DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE,
4445
true,
45-
irep_idt{},
46+
empty_language_mode,
4647
manager,
4748
fresh_name};
4849

unit/goto-symex/symex_assign.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ SCENARIO(
4848
auto fresh_name = [&fresh_name_count](const irep_idt &) {
4949
return fresh_name_count++;
5050
};
51+
const irep_idt empty_language_mode;
5152
goto_symex_statet state{
5253
source,
5354
DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE,
5455
true,
55-
irep_idt{},
56+
empty_language_mode,
5657
manager,
5758
fresh_name};
5859

@@ -234,7 +235,7 @@ SCENARIO(
234235
symex_targett::assignment_typet::STATE,
235236
ns,
236237
symex_config,
237-
irep_idt{},
238+
empty_language_mode,
238239
target_equation}
239240
.assign_symbol(struct1_ssa, skeleton, rhs, guard);
240241
THEN("Two equations are added to the target")

0 commit comments

Comments
 (0)