Merge pull request #1996 from bbbradsmith/negative_memory_size_error

ld65 error if computed memory size is negative
This commit is contained in:
Bob Andrews 2023-02-19 18:45:09 +01:00 committed by GitHub
commit d0f17ba602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1936,6 +1936,11 @@ unsigned CfgProcess (void)
GetString (M->Name));
}
M->Size = GetExprVal (M->SizeExpr);
if (M->Size >= 0x80000000) {
CfgError (GetSourcePos (M->LI),
"Size of memory area '%s' is negative: %ld",
GetString (M->Name), (long)M->Size);
}
/* Walk through the segments in this memory area */
for (J = 0; J < CollCount (&M->SegList); ++J) {

View File

@ -30,7 +30,7 @@ ISEQUAL = ../../testwrk/isequal$(EXE)
CC = gcc
CFLAGS = -O2
START = --start-addr 0x8000
START = --start-addr 0x7000
.PHONY: all clean