From 63a8fe07ee7226016f9e2edcd829c03236829584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Mon, 6 Nov 2023 10:53:57 +0100 Subject: [PATCH] * Avoid access violation, use internalerror instead. See also issue #40502 --- compiler/pgenutil.pas | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 5735f39e42..6f2b1062d1 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -2752,7 +2752,20 @@ uses interface is still being parsed and thus the localsymtable is in reality the global symtable } if pu.u.in_interface then - symtablestack.push(pu.u.localsymtable) + begin + { + MVC: The case where localsymtable is also nil can appear in complex cases and still produce valid code. + In order to allow people in this case to continue, SKIP_INTERNAL20231102 can be defined. + Default behaviour is to raise an internal error. + } + {$IFDEF SKIP_INTERNAL20231102} + if (pu.u.localsymtable<>Nil) then + {$ELSE} + if (pu.u.localsymtable=Nil) then + internalerror(20231102); + {$ENDIF} + symtablestack.push(pu.u.localsymtable); + end else internalerror(200705153) else