Commit 1d4adbf3 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed compiler crash during code genration for type conversion (bug 541100)



Change-Id: I273b620304bd9dbb9252940759314124fba42028
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 43e665c4
......@@ -12723,7 +12723,8 @@ void Value::chk_expr_operand_execute_refd(Value *v1,
if (!get_needs_conversion()) {
u.ref.ref->generate_code_const_ref(expr);
} else {
Type *my_gov = get_expr_governor_last();
Type *my_gov = my_governor != NULL ? my_governor->get_type_refd_last() :
get_expr_governor_last();
Type *refd_gov = u.ref.ref->get_refd_assignment()->get_Type()
->get_field_type(u.ref.ref->get_subrefs(),
Type::EXPECTED_DYNAMIC_VALUE)->get_type_refd_last();
......
......@@ -572,6 +572,34 @@ testcase tc_Templates() runs on Empty {
if (match({ vm1, vm1 }, tp_rec9)) { setverdict(pass) } else { setverdict(fail) }
}
// Bug 541100 - Compiler crash during code generation for type conversion
type record Rec1 {
integer x
}
type record Rec2 {
integer y
}
type record Main541100 {
Rec2 field
}
template (value) Main541100 t_541100(template(value) Rec2 p) := { p };
const Rec1 c_541100 := { 1 };
testcase tc_541100() runs on Empty {
template (value) Main541100 t_res := t_541100(c_541100); // parameter needs type conversion
if (not isvalue(t_res) or valueof(t_res) != { { 1 } }) {
setverdict(fail, t_res);
}
else {
setverdict(pass);
}
}
control {
var myrec1 rec1 := { 66, 77 }
var myrec2 rec2 := { 88, 99 }
......@@ -593,6 +621,7 @@ control {
execute(Std.tc_Unions())
execute(Std.tc_Anytypes())
execute(Std.tc_Substruct())
execute(tc_541100());
}
} with { extension "anytype myrec1, myrec2" }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment