Using the following can generate anonymous symbol without
initializer expression.

        return (struct foo) {};

It would be nice if sparse does not crash on it.

Signed-Off-By: Christopher Li <[EMAIL PROTECTED]>

Index: sparse/linearize.c
===================================================================
--- sparse.orig/linearize.c     2007-01-30 19:47:10.000000000 -0800
+++ sparse/linearize.c  2007-01-30 19:47:54.000000000 -0800
@@ -116,14 +116,16 @@ const char *show_pseudo(pseudo_t pseudo)
                }
                expr = sym->initializer;
                snprintf(buf, 64, "<anon symbol:%p>", sym);
-               switch (expr->type) {
-               case EXPR_VALUE:
-                       snprintf(buf, 64, "<symbol value: %lld>", expr->value);
-                       break;
-               case EXPR_STRING:
-                       return show_string(expr->string);
-               default:
-                       break;
+               if (expr) {
+                       switch (expr->type) {
+                       case EXPR_VALUE:
+                               snprintf(buf, 64, "<symbol value: %lld>", 
expr->value);
+                               break;
+                       case EXPR_STRING:
+                               return show_string(expr->string);
+                       default:
+                               break;
+                       }
                }
                break;
        }
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to