From 91094e9292d97776654dfe876e2bc98d2f04bb30 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 23 Dec 2019 19:59:18 -0600 Subject: [PATCH] Correctly increment/decrement pointers to large (>=64KiB) types. Previously, the logic for this was incorrect and would lead to a null pointer dereference in the compiler. In most cases the generated code would not actually change the pointer. The following program demonstrates the issue: #include #pragma memorymodel 1 typedef char bigarray[0x20000]; bigarray big[5]; int main(void) { bigarray *p = big; p++; printf("%p %p\n", (void*)big, (void*)p); } --- Expression.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Expression.pas b/Expression.pas index 2c03d0f..f7fbc20 100644 --- a/Expression.pas +++ b/Expression.pas @@ -2535,7 +2535,7 @@ var Gen0(pc_adl) else Gen0(pc_sbl); - with tree^.left^.id^ do + with tree^.id^ do case storage of stackFrame, parameter: Gen2t(pc_cop, lln, 0, cgULong);