GP-4133 Adjustment for forced indirect return

This commit is contained in:
caheckman 2023-12-11 22:38:21 +00:00
parent 2259379a67
commit 99d8762b9c
2 changed files with 3 additions and 7 deletions

View file

@ -1512,13 +1512,12 @@ void ParamListStandardOut::assignMap(const PrototypePieces &proto,TypeFactory &t
Datatype *pointertp = typefactory.getTypePointer(pointersize, proto.outtype, wordsize);
if (responseCode == AssignAction::hiddenret_specialreg_void) {
res.back().type = typefactory.getTypeVoid();
res.back().flags = 0;
}
else {
if (assignAddressFallback(TYPECLASS_PTR,pointertp,false,status,res.back()) == AssignAction::fail)
throw ParamUnassignedError("Cannot assign return value as a pointer");
res.back().flags = ParameterPieces::indirectstorage;
}
res.back().flags = ParameterPieces::indirectstorage;
res.emplace_back(); // Add extra storage location in the input params
res.back().type = pointertp; // that holds a pointer to where the return value should be stored

View file

@ -92,18 +92,15 @@ public class ParameterPieces {
VariableStorage store;
try {
if (joinPieces != null) {
store = new DynamicVariableStorage(program, false, joinPieces);
store = new DynamicVariableStorage(program, isIndirect, joinPieces);
}
else {
if (hiddenReturnPtr) {
store = new DynamicVariableStorage(program,
AutoParameterType.RETURN_STORAGE_PTR, address, sz);
}
else if (isIndirect) {
store = new DynamicVariableStorage(program, true, address, sz);
}
else {
store = new DynamicVariableStorage(program, false, address, sz);
store = new DynamicVariableStorage(program, isIndirect, address, sz);
}
}
}