From f542ee7b92e90fca148df15f35c50d3040d3fd03 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 1 Aug 2020 21:11:35 +0000 Subject: [PATCH] * do not throw an internal error if an errorneous type is passed to str, resolves #37462 git-svn-id: trunk@45983 - --- .gitattributes | 1 + compiler/ninl.pas | 10 +++++++--- tests/webtbf/tw37462.pp | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tests/webtbf/tw37462.pp diff --git a/.gitattributes b/.gitattributes index 4f57d57946..3b01c8f5de 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16542,6 +16542,7 @@ tests/webtbf/tw37303.pp -text svneol=native#text/pascal tests/webtbf/tw3738.pp svneol=native#text/plain tests/webtbf/tw3740.pp svneol=native#text/plain tests/webtbf/tw37460.pp svneol=native#text/pascal +tests/webtbf/tw37462.pp svneol=native#text/pascal tests/webtbf/tw3790.pp svneol=native#text/plain tests/webtbf/tw3812.pp svneol=native#text/plain tests/webtbf/tw3930a.pp svneol=native#text/plain diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 533d65bd6a..4f1ac2f987 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -273,8 +273,12 @@ implementation end; { in case we are in a generic definition, we cannot - do all checks, the parameters might be type parameters } - if df_generic in current_procinfo.procdef.defoptions then + do all checks, the parameters might be type parameters, + + bailout as well in case of an error before } + if (df_generic in current_procinfo.procdef.defoptions) or + (dest.resultdef.typ=errordef) or + (source.resultdef.typ=errordef) then begin result.Free; result:=nil; @@ -1477,7 +1481,7 @@ implementation begin ordtype := torddef(def).ordtype; if not (ordtype in [s64bit,u64bit,s32bit,u32bit,s16bit,u16bit,s8bit,u8bit]) then - internalerror(2013032603); + internalerror(2020080101); if is_oversizedint(def) then begin diff --git a/tests/webtbf/tw37462.pp b/tests/webtbf/tw37462.pp new file mode 100644 index 0000000000..faed58b2cb --- /dev/null +++ b/tests/webtbf/tw37462.pp @@ -0,0 +1,3 @@ +{ %fail } +var a : string; +begin str(1 > 1 > 1, a)