re PR fortran/15314 (ICE caused by array initializer in derived type definition)
authorPaul Brook <paul@codesourcery.com>
Thu, 13 May 2004 23:11:47 +0000 (23:11 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Thu, 13 May 2004 23:11:47 +0000 (23:11 +0000)
PR fortran/15314
* trans-expr.c (gfc_conv_structure): Use field type, not expr type.

From-SVN: r81816

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c

index 180bc22038870a89c5c55329c4e0c411a8023e8d..e32d1885ed81d28b9a05f011f8d46df684e0fc82 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-13  Paul Brook  <paul@codesourcery.com>
+
+       PR fortran/15314
+       * trans-expr.c (gfc_conv_structure): Use field type, not expr type.
+
 2004-05-13  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * gfortran.texi: Use @table @emph instead of @itemize @emph.
index 864b006c536d410f58316bc10179b3f0c06d0b95..1f98f9e1a89c6baaea1a0445afc95a237d0c338b 100644 (file)
@@ -1292,20 +1292,15 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init)
       /* Evaluate the expression for this component.  */
       if (init)
        {
-         switch (c->expr->expr_type)
+         if (cm->dimension)
            {
-           case EXPR_ARRAY:
              arraytype = TREE_TYPE (cm->backend_decl);
              cse.expr = gfc_conv_array_initializer (arraytype, c->expr);
-             break;
-
-           case EXPR_STRUCTURE:
-             gfc_conv_structure (&cse, c->expr, 1);
-             break;
-
-           default:
-             gfc_conv_expr (&cse, c->expr);
            }
+         else if (cm->ts.type == BT_DERIVED)
+           gfc_conv_structure (&cse, c->expr, 1);
+         else
+           gfc_conv_expr (&cse, c->expr);
        }
       else
        {