diff --git a/src/cc65/compile.c b/src/cc65/compile.c
index 9d7fbe20a..713e70d2a 100644
--- a/src/cc65/compile.c
+++ b/src/cc65/compile.c
@@ -285,11 +285,14 @@ static void Parse (void)
                         */
                         const char* bssName = GetSegName (SEG_BSS);
 
-                        if (Sym->V.BssName && strcmp (Sym->V.BssName, bssName) != 0) {
-                            Error ("Global variable '%s' already was defined in the '%s' segment.",
-                                   Sym->Name, Sym->V.BssName);
+                        if (Sym->V.BssName != 0) {
+                            if (strcmp (Sym->V.BssName, bssName) != 0) {
+                                Error ("Global variable '%s' already was defined in the '%s' segment",
+                                       Sym->Name, Sym->V.BssName);
+                            }
+                        } else {
+                            Sym->V.BssName = xstrdup (bssName);
                         }
-                        Sym->V.BssName = xstrdup (bssName);
 
                         /* This is to make the automatical zeropage setting of the symbol
                         ** work right.