mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-09-27 03:54:30 +00:00
Fix varargs stack repair.
Varargs-only stack repair (i.e. using #pragma optimize bit 3 but not bit 6) was broken by commit32975b720f
. It removed some code that was needed to allocate the direct page location used to hold the stack pointer value in that case. This would lead to invalid code being produced, which could cause a crash when run. The fix is to revert the erroneous parts of commit32975b720f
(which do not affect its core purpose of enabling intermediate code peephole optimization to be used when stack repair code is active).
This commit is contained in:
parent
74b9885572
commit
2958619726
1
CGI.pas
1
CGI.pas
@ -364,6 +364,7 @@ var
|
||||
symLength: integer; {length of debug symbol table}
|
||||
toolParms: boolean; {generate tool format parameters?}
|
||||
volatile: boolean; {has a volatile qualifier been used?}
|
||||
hasVarargsCall: boolean; {does current function call any varargs fns?}
|
||||
|
||||
{desk accessory variables}
|
||||
{------------------------}
|
||||
|
@ -3508,6 +3508,8 @@ var
|
||||
Gen1tName(pc_cup, ord(hasVarargs and strictVararg),
|
||||
UsualUnaryConversions, fname);
|
||||
end; {else}
|
||||
if hasVarargs then
|
||||
hasVarargsCall := true;
|
||||
end {if}
|
||||
else
|
||||
GenTool(pc_tl1, ftype^.toolNum, long(ftype^.ftype^.size).lsw,
|
||||
|
2
Gen.pas
2
Gen.pas
@ -7679,7 +7679,7 @@ while bk <> nil do begin
|
||||
end; {while}
|
||||
bk := bk^.next;
|
||||
end; {while}
|
||||
if saveStack or checkStack then begin
|
||||
if saveStack or checkStack or (strictVararg and hasVarargsCall) then begin
|
||||
stackLoc := minSize;
|
||||
minSize := minSize + 2;
|
||||
localSize := localSize + 2;
|
||||
|
@ -4019,6 +4019,7 @@ if isFunction then begin
|
||||
end; {if}
|
||||
Gen2Name(dc_str, segType, 0, fName);
|
||||
doingMain := variable^.name^ = 'main';
|
||||
hasVarargsCall := false;
|
||||
firstCompoundStatement := true;
|
||||
Gen0 (dc_pin);
|
||||
if not isAsm then
|
||||
|
Loading…
Reference in New Issue
Block a user