]> git.sur5r.net Git - cc65/commitdiff
Issue an error for duplicate global variables.
authorPiotr Fusik <fox@scene.pl>
Mon, 13 Feb 2017 20:10:21 +0000 (21:10 +0100)
committerPiotr Fusik <fox@scene.pl>
Mon, 13 Feb 2017 20:10:21 +0000 (21:10 +0100)
Previously it was an assembler error.

src/cc65/compile.c

index 85a2e9939572b672869b68386d3c350d938c99f5..9cdeaf7e5cd7cf2342ec6e1c27b39f3bfb8619db 100644 (file)
@@ -188,6 +188,10 @@ static void Parse (void)
                 if (CurTok.Tok == TOK_ASSIGN) {
 
                     /* This is a definition */
+                    if (SymIsDef (Entry)) {
+                        Error ("Global variable `%s' has already been defined",
+                               Entry->Name);
+                    }
                     Entry->Flags |= SC_DEF;
 
                     /* We cannot initialize types of unknown size, or