ref: b069278e98b19e367b78c8dc4f16ea48edfd6213
parent: 9738c88f957e51ff6834c0382b73bf7331fa25b2
parent: a6bf77718cc823cc6ca78aefdaa0e21ea72a460f
author: Eldred Habert <[email protected]>
date: Thu Aug 29 15:05:27 EDT 2019
Merge pull request #384 from dbrotz/fix-local-label-segfault Check if parent exists for local label reference
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -735,6 +735,9 @@
int isLocal = 0;
if (*tzSym == '.') {
+ if (!pScope)
+ fatalerror("Local label reference '%s' in main scope",
+ tzSym);
fullSymbolName(fullname, sizeof(fullname), tzSym,
pScope);
tzSym = fullname;
--- /dev/null
+++ b/test/asm/local-ref-without-parent.asm
@@ -1,0 +1,3 @@
+SECTION "sec", ROM0
+
+dw .test
--- /dev/null
+++ b/test/asm/local-ref-without-parent.out
@@ -1,0 +1,2 @@
+ERROR: local-ref-without-parent.asm(3):
+ Local label reference '.test' in main scope
--- /dev/null
+++ b/test/asm/local-ref-without-parent.out.pipe
@@ -1,0 +1,2 @@
+ERROR: -(3):
+ Local label reference '.test' in main scope