From eb722c8294f91f274806673ee4941fd40334890a Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 14 Dec 2020 11:21:10 +0000 Subject: [PATCH 1/3] Fix ash_savefregp_x handling, as revealed by range check error git-svn-id: trunk@47773 - --- compiler/aarch64/agcpugas.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/aarch64/agcpugas.pas b/compiler/aarch64/agcpugas.pas index 01c239b588..35eafef1e7 100644 --- a/compiler/aarch64/agcpugas.pas +++ b/compiler/aarch64/agcpugas.pas @@ -229,7 +229,7 @@ unit agcpugas; begin check_offset(seh.data.offset,512); check_reg(seh.data.reg,R_MMREGISTER,min_mm_reg); - writeword($DA00 or ((getsupreg(seh.data.reg)-min_int_reg) shl 6) or ((seh.data.offset shr 3)-1)); + writeword($DA00 or ((getsupreg(seh.data.reg)-min_mm_reg) shl 6) or ((seh.data.offset shr 3)-1)); end; else internalerror(2020041503); From 00af340febfa4f8b38630d5818f3003d8e74d4dc Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 14 Dec 2020 21:55:41 +0000 Subject: [PATCH 2/3] * cleanup git-svn-id: trunk@47774 - --- compiler/psub.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/psub.pas b/compiler/psub.pas index d1cc7e47d6..829505ecc7 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1136,9 +1136,8 @@ implementation { parasize must be really zero, this means also that no result may be returned in a parameter } and not((current_procinfo.procdef.proccalloption in clearstack_pocalls) and - not(current_procinfo.procdef.generate_safecall_wrapper) and - paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef)) - {and (para_stack_size=0)} then + not(current_procinfo.procdef.generate_safecall_wrapper) and + paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef)) then begin { Only need to set the framepointer } framepointer:=NR_STACK_POINTER_REG; From 2e2f2eb78467fd70d59196033a7197e9428f3992 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 14 Dec 2020 21:55:42 +0000 Subject: [PATCH 3/3] - remove could which prevented that rte is triggered even if we are inside an exception block but *without* using sysutils. The remove code was once added to have primitive exception handling even if no sysutils is used. But if this is desired, an appropriate handler to ErrorProc should be assigned. Resolves #38201 git-svn-id: trunk@47775 - --- .gitattributes | 1 + rtl/inc/system.inc | 4 ---- tests/webtbs/tw38201.pp | 23 +++++++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 tests/webtbs/tw38201.pp diff --git a/.gitattributes b/.gitattributes index 4a41189945..5bada7b801 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18605,6 +18605,7 @@ tests/webtbs/tw3814.pp svneol=native#text/plain tests/webtbs/tw38145a.pp svneol=native#text/pascal tests/webtbs/tw38145b.pp svneol=native#text/pascal tests/webtbs/tw38151.pp svneol=native#text/pascal +tests/webtbs/tw38201.pp svneol=native#text/pascal tests/webtbs/tw38202.pp svneol=native#text/pascal tests/webtbs/tw3827.pp svneol=native#text/plain tests/webtbs/tw3829.pp svneol=native#text/plain diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 9b1f7932e1..6dbf9d73fc 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -1327,10 +1327,6 @@ begin errorcode:=word(Errno); erroraddr:=addr; errorbase:=frame; -{$ifdef FPC_HAS_FEATURE_EXCEPTIONS} - if ExceptAddrStack <> nil then - raise TObject(nil) at addr,frame; -{$endif FPC_HAS_FEATURE_EXCEPTIONS} Halt(errorcode); end; diff --git a/tests/webtbs/tw38201.pp b/tests/webtbs/tw38201.pp new file mode 100644 index 0000000000..7cf49f2f13 --- /dev/null +++ b/tests/webtbs/tw38201.pp @@ -0,0 +1,23 @@ +{ %result=201 } +program Test; +{$apptype console} +{$ifdef fpc} +{$mode objfpc} +{$endif fpc} +{$R+} + +var + Arr: array[1..2] of integer; + i: Integer; +begin + i:=5; + try + try + Arr[i] := 1; + except + writeln('Except block'); + end; + finally + writeln('Finally block'); + end; +end.