summaryrefslogtreecommitdiff
path: root/compiler/x86_64
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-10-08 20:38:19 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-10-08 20:38:19 +0000
commit543dba1bd5901b282285c114be51f89cd4890f5e (patch)
tree587591e7aa738f227ee6f118cbcc9b8171e15578 /compiler/x86_64
parent4fe491408efea9374940ec0c96202ed006488b06 (diff)
downloadfpc-543dba1bd5901b282285c114be51f89cd4890f5e.tar.gz
* patch by J. Gareth Moreton: propagate exit use in nested try...except statements,
resolves #35841 git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47066 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/x86_64')
-rw-r--r--compiler/x86_64/nx64flw.pas18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/x86_64/nx64flw.pas b/compiler/x86_64/nx64flw.pas
index b205bf8987..20ac25cf57 100644
--- a/compiler/x86_64/nx64flw.pas
+++ b/compiler/x86_64/nx64flw.pas
@@ -321,6 +321,12 @@ procedure tx64tryfinallynode.pass_generate_code;
cg.a_label(current_asmdata.CurrAsmList,endtrylabel);
end;
+ { i32913 - if the try..finally block is also inside a try..finally or
+ try..except block, make a note of any Exit calls so all necessary labels
+ are generated. [Kit] }
+ if (fc_exit in flowcontrol) and (fc_inflowcontrol in oldflowcontrol) then
+ Include(oldflowcontrol, fc_exit);
+
flowcontrol:=[fc_inflowcontrol];
{ generate finally code as a separate procedure }
if not implicitframe then
@@ -431,6 +437,12 @@ procedure tx64tryexceptnode.pass_generate_code;
current_procinfo.CurrBreakLabel:=breakexceptlabel;
end;
+ { i32913 - if the try..finally block is also inside a try..finally or
+ try..except block, make a note of any Exit calls so all necessary labels
+ are generated. [Kit] }
+ if (fc_exit in flowcontrol) and (fc_inflowcontrol in oldflowcontrol) then
+ Include(oldflowcontrol, fc_exit);
+
flowcontrol:=[fc_inflowcontrol];
{ on statements }
if assigned(right) then
@@ -521,6 +533,12 @@ errorexit:
{ restore all saved labels }
endexceptlabel:=oldendexceptlabel;
+ { i32913 - if the try..finally block is also inside a try..finally or
+ try..except block, make a note of any Exit calls so all necessary labels
+ are generated. [Kit] }
+ if (fc_exit in flowcontrol) and (fc_inflowcontrol in oldflowcontrol) then
+ Include(oldflowcontrol, fc_exit);
+
{ restore the control flow labels }
current_procinfo.CurrExitLabel:=oldCurrExitLabel;
if assigned(oldBreakLabel) then