shithub: rgbds

Download patch

ref: 05256946ac03124188b0157ebd8f75a26f3b43e6
parent: 73396166aaca4542fc1708d6febd0a959e05df88
parent: b07aa00d5cfda645978747d25c20643b7cc1ee7e
author: Eldred Habert <[email protected]>
date: Tue Oct 13 06:47:57 EDT 2020

Merge pull request #604 from NieDzejkob/narg-overwrite

Don't overwrite symbol when it's not allowed

--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -409,6 +409,7 @@
 		      symName, sym->type == SYM_LABEL ? "label" : "constant");
 		dumpFilename(sym);
 		putc('\n', stderr);
+		return sym;
 	} else {
 		/* TODO: can the scope be incorrect when taking over refs? */
 		updateSymbolFilename(sym);
--- /dev/null
+++ b/test/asm/narg-overwrite.asm
@@ -1,0 +1,2 @@
+_NARG = 0
+_NARG = 0
--- /dev/null
+++ b/test/asm/narg-overwrite.err
@@ -1,0 +1,5 @@
+ERROR: narg-overwrite.asm(1):
+    '_NARG' already defined as constant at <builtin>
+ERROR: narg-overwrite.asm(2):
+    '_NARG' already defined as constant at <builtin>
+error: Assembly aborted (2 errors)!