From 31f19fbc6579a57186cc44e06e8494a34b9de057 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Mon, 13 Feb 2017 21:10:21 +0100 Subject: [PATCH] Issue an error for duplicate global variables. Previously it was an assembler error. --- src/cc65/compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 85a2e9939..9cdeaf7e5 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -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 -- 2.39.5