From 7626a9159263e3a55d57c97ab27f56a453ae2ba1 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 2 Nov 2008 15:13:20 +0000 Subject: [PATCH] * disabled last safecall code for non-windows (mantis #12237) git-svn-id: trunk@12021 - --- .gitattributes | 1 + compiler/ncgcal.pas | 3 ++- compiler/psub.pas | 1 + tests/webtbs/tw12237.pp | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw12237.pp diff --git a/.gitattributes b/.gitattributes index 3a5655175e..215b380d2e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8600,6 +8600,7 @@ tests/webtbs/tw1222.pp svneol=native#text/plain tests/webtbs/tw12224.pp svneol=native#text/plain tests/webtbs/tw1223.pp svneol=native#text/plain tests/webtbs/tw12233.pp svneol=native#text/plain +tests/webtbs/tw12237.pp svneol=native#text/plain tests/webtbs/tw12242.pp svneol=native#text/plain tests/webtbs/tw12249.pp svneol=native#text/plain tests/webtbs/tw1228.pp svneol=native#text/plain diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index 0944f4d03f..9b16329536 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -1105,7 +1105,8 @@ implementation end; {$if defined(x86) or defined(arm)} - if procdefinition.proccalloption=pocall_safecall then + if (procdefinition.proccalloption=pocall_safecall) and + (target_info.system in system_all_windows) then begin {$ifdef x86_64} cgpara.init; diff --git a/compiler/psub.pas b/compiler/psub.pas index 935bea713b..640a4d86c5 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1063,6 +1063,7 @@ implementation {$if defined(x86) or defined(arm)} { Set return value of safecall procedure if implicit try/finally blocks are disabled } if not (cs_implicit_exceptions in current_settings.moduleswitches) and + (target_info.system in system_all_windows) and (procdef.proccalloption=pocall_safecall) then cg.a_load_const_reg(aktproccode,OS_ADDR,0,NR_FUNCTION_RETURN_REG); {$endif} diff --git a/tests/webtbs/tw12237.pp b/tests/webtbs/tw12237.pp new file mode 100644 index 0000000000..fe9f549376 --- /dev/null +++ b/tests/webtbs/tw12237.pp @@ -0,0 +1,9 @@ +function f: longint; safecall; +begin + f:=-2; +end; + +begin + if (f<>-2) then + halt(1); +end.