re PR fortran/79335 (Conditional jump or move depends on uninitialised in value ...
authorAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 19 Feb 2017 18:18:33 +0000 (19:18 +0100)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 19 Feb 2017 18:18:33 +0000 (19:18 +0100)
gcc/fortran/ChangeLog:

2017-02-19  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/79335
* trans-array.c (duplicate_allocatable_coarray): Ensure attributes
passed are properly initialized.
(structure_alloc_comps): Same.
* trans-expr.c (gfc_trans_structure_assign): Same.

From-SVN: r245579

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

index d9c269da6cfc32619beb1a6e330f831809d9b923..f7a89cca0ec0c002f55ecce35856225402add499 100644 (file)
@@ -1,3 +1,11 @@
+2017-02-19  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/79335
+       * trans-array.c (duplicate_allocatable_coarray): Ensure attributes
+       passed are properly initialized.
+       (structure_alloc_comps): Same.
+       * trans-expr.c (gfc_trans_structure_assign): Same.
+
 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
 
        * trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.
index d0dfc264f872fcd20a0c0d9250ea2bb5a7bc08e7..47e8c091a9b08b343a4bc3045edc1abdb38fa06f 100644 (file)
@@ -7950,6 +7950,8 @@ duplicate_allocatable_coarray (tree dest, tree dest_tok, tree src,
       tree dummy_desc;
 
       gfc_init_se (&se, NULL);
+      gfc_clear_attr (&attr);
+      attr.allocatable = 1;
       dummy_desc = gfc_conv_scalar_to_descriptor (&se, dest, attr);
       gfc_add_block_to_block (&globalblock, &se.pre);
       size = TYPE_SIZE_UNIT (TREE_TYPE (type));
@@ -8518,14 +8520,15 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
              else
                {
                  gfc_se se;
-                 symbol_attribute attr;
 
                  gfc_init_se (&se, NULL);
-                 gfc_clear_attr (&attr);
                  token = fold_build3_loc (input_location, COMPONENT_REF,
                                           pvoid_type_node, decl, c->caf_token,
                                           NULL_TREE);
-                 comp = gfc_conv_scalar_to_descriptor (&se, comp, attr);
+                 comp = gfc_conv_scalar_to_descriptor (&se, comp,
+                                                       c->ts.type == BT_CLASS
+                                                       ? CLASS_DATA (c)->attr
+                                                       : c->attr);
                  gfc_add_block_to_block (&fnblock, &se.pre);
                }
 
index 87bf069ffb65fd71dbdce8d6c89b3de671fad9fc..cc41fe3fe6d0bfdc0acd730ae0e910d365bb5a09 100644 (file)
@@ -7516,7 +7516,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
          && (!c->expr || c->expr->expr_type == EXPR_NULL))
        {
          tree token, desc, size;
-         symbol_attribute attr;
          bool is_array = cm->ts.type == BT_CLASS
              ? CLASS_DATA (cm)->attr.dimension : cm->attr.dimension;
 
@@ -7549,7 +7548,10 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
            }
          else
            {
-             desc = gfc_conv_scalar_to_descriptor (&se, field, attr);
+             desc = gfc_conv_scalar_to_descriptor (&se, field,
+                                                   cm->ts.type == BT_CLASS
+                                                   ? CLASS_DATA (cm)->attr
+                                                   : cm->attr);
              size = TYPE_SIZE_UNIT (TREE_TYPE (field));
            }
          gfc_add_block_to_block (&block, &se.pre);