(output_constructor): Use the type given by the constructor expression only if available.
authorKresten Krab Thorup <krab@gcc.gnu.org>
Wed, 22 Sep 1993 17:38:20 +0000 (17:38 +0000)
committerKresten Krab Thorup <krab@gcc.gnu.org>
Wed, 22 Sep 1993 17:38:20 +0000 (17:38 +0000)
(output_constructor): Use the type given
by the constructor expression only if available.  Otherwise
use the type of the declared type.

From-SVN: r5390

gcc/varasm.c

index 7d16f36a2a34e41150be5d326c14e4a89709880f..641c6b7ff97086f7d7585983545138e03ad41ee1 100644 (file)
@@ -3396,7 +3396,11 @@ output_constructor (exp, size)
 
       if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
          || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE)
-       field = TREE_PURPOSE (link);
+       {
+         /* if available, use the type given by link */
+         if (TREE_PURPOSE (link) != 0)
+           field = TREE_PURPOSE (link);
+       }
 
       if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
        index = TREE_PURPOSE (link);