* src/SDCCast.c (createIvalCharPtr): fixed bug 1348271
[fw/sdcc] / src / SDCCast.c
index 108f6d73e7d4fc89eea38853d720f6c9dfad2cfd..d82a071942e6a1615652bc0b8433f36489bc0703 100644 (file)
@@ -1030,8 +1030,12 @@ createIvalCharPtr (ast * sym, sym_link * type, ast * iexpr)
       if (size>symsize)
         {
           if (size>(symsize+1))
-            werrorfl (iexpr->filename, iexpr->lineno, W_EXCESS_INITIALIZERS,
-                      "string", sym->opval.val->sym->name);
+            {
+              char *name = (IS_AST_SYM_VALUE(sym)) ? AST_SYMBOL(sym)->name : "";
+
+              werrorfl (iexpr->filename, iexpr->lineno, W_EXCESS_INITIALIZERS,
+                        "string", name);
+            }
           size = symsize;
         }