fixes for ZAM tracking the return type associated with function calls

This commit is contained in:
Vern Paxson 2024-09-11 16:42:54 +02:00 committed by Christian Kreibich
parent 56d01ea83b
commit e7817b709c

View file

@ -1134,8 +1134,10 @@ const ZAMStmt ZAMCompiler::DoCall(const CallExpr* c, const NameExpr* n) {
ZInstI z; ZInstI z;
if ( call_case == 0 ) { if ( call_case == 0 ) {
if ( n ) if ( n ) {
z = ZInstI(AssignmentFlavor(OP_CALL0_V, nt), n_slot); z = ZInstI(AssignmentFlavor(OP_CALL0_V, nt), n_slot);
z.SetType(n->GetType());
}
else else
z = ZInstI(OP_CALL0_X); z = ZInstI(OP_CALL0_X);
} }
@ -1228,6 +1230,8 @@ const ZAMStmt ZAMCompiler::DoCall(const CallExpr* c, const NameExpr* n) {
z = ZInstI(op, n_slot); z = ZInstI(op, n_slot);
z.op_type = OP_V; z.op_type = OP_V;
} }
z.SetType(n->GetType());
} }
else { else {
if ( indirect && ! func_id->IsGlobal() ) { if ( indirect && ! func_id->IsGlobal() ) {
@ -1263,9 +1267,6 @@ const ZAMStmt ZAMCompiler::DoCall(const CallExpr* c, const NameExpr* n) {
z.aux->call_expr = {NewRef{}, const_cast<CallExpr*>(c)}; z.aux->call_expr = {NewRef{}, const_cast<CallExpr*>(c)};
if ( in_when )
z.SetType(n->GetType());
if ( ! indirect || func_id->IsGlobal() ) { if ( ! indirect || func_id->IsGlobal() ) {
z.aux->id_val = func_id; z.aux->id_val = func_id;