From b5f8800817d20ad47543be96a9c92c02bec1465a Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 30 Jun 2026 01:44:28 +0100 Subject: [PATCH] fix(testing): rename global GRegistry to GTestRegistry to avoid symbol clash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test framework's `GRegistry: TList` collided with `GRegistry: TTargetRegistry` in blaise.codegen.toolkit. The compiler emits unit-level globals under their bare name with export (strong) linkage, so both `GRegistry` symbols resolved to one shared 8-byte slot. When the test runner links both units, the test framework and the codegen toolkit alias the same storage and free/read it as the wrong type at teardown. Rename the test-framework global to GTestRegistry — a unit-specific name that collides with nothing else — so the two registries occupy distinct storage. --- stdlib/src/main/pascal/blaise.testing.pas | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stdlib/src/main/pascal/blaise.testing.pas b/stdlib/src/main/pascal/blaise.testing.pas index df45fec..2438314 100644 --- a/stdlib/src/main/pascal/blaise.testing.pas +++ b/stdlib/src/main/pascal/blaise.testing.pas @@ -205,7 +205,7 @@ implementation ----------------------------------------------------------------------- } var - GRegistry: TList; { registered test-case classes } + GTestRegistry: TList; { registered test-case classes } { ----------------------------------------------------------------------- TTest @@ -655,22 +655,22 @@ end; procedure RegisterTest(ATestClass: TTestCaseClass); begin - if GRegistry = nil then - GRegistry := TList.Create(); - GRegistry.Add(ATestClass); + if GTestRegistry = nil then + GTestRegistry := TList.Create(); + GTestRegistry.Add(ATestClass); end; function GetRegisteredTestCount: Integer; begin - if GRegistry = nil then + if GTestRegistry = nil then Result := 0 else - Result := GRegistry.Count; + Result := GTestRegistry.Count; end; function GetRegisteredTest(AIndex: Integer): TTestCaseClass; begin - Result := GRegistry.Get(AIndex); + Result := GTestRegistry.Get(AIndex); end; end.