c-typeck.c (initializer_constant_valid_p): Don't dereference a null pointer on partia...
authorJeff Law <law@gcc.gnu.org>
Wed, 21 Feb 1996 17:44:20 +0000 (10:44 -0700)
committerJeff Law <law@gcc.gnu.org>
Wed, 21 Feb 1996 17:44:20 +0000 (10:44 -0700)
        * c-typeck.c (initializer_constant_valid_p): Don't dereference
        a null pointer on partial structure initialization.

From-SVN: r11333

gcc/c-typeck.c

index da52a8da6082186d199e009c67aa6a31f83585bb..0ffbf80a8e94702189a055aa55a4b132791d8585 100644 (file)
@@ -4279,7 +4279,8 @@ initializer_constant_valid_p (value, endtype)
     case CONSTRUCTOR:
       if ((TREE_CODE (TREE_TYPE (value)) == UNION_TYPE
           || TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE)
-         && TREE_CONSTANT (value))
+         && TREE_CONSTANT (value)
+         && CONSTRUCTOR_ELTS (value))
        return
          initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)),
                                        endtype);