]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR 92208 + PR 92277 – GCC 9 follow-up fix
authorTobias Burnus <tobias@codesourcery.com>
Tue, 5 Nov 2019 14:28:07 +0000 (14:28 +0000)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 5 Nov 2019 14:28:07 +0000 (15:28 +0100)
        PR fortran/92208
        Backport from mainline
        2019-10-31  Tobias Burnus  <tobias@codesourcery.com>

        PR fortran/92277
        * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Fix DECL_ARTIFICIAL
        checking.

From-SVN: r277840

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

index e8ab85fc424805906bb24d9b986f2bcb2b922d69..a9369691722177c4cb6037b8f00365fe6de74133 100644 (file)
@@ -1,3 +1,13 @@
+2019-11-05  Tobias Burnus  <tobias@codesourcery.com>
+
+       PR fortran/92208
+       Backport from mainline
+       2019-10-31  Tobias Burnus  <tobias@codesourcery.com>
+
+       PR fortran/92277
+       * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Fix DECL_ARTIFICIAL
+       checking.
+
 2019-11-04  Tobias Burnus  <tobias@codesourcery.com>
 
        Backport from mainline
index 245e656a1f815e9efdd2267b76911d4456dded9a..52a8cdd6902e11fbdf45394ae6a130e95222d983 100644 (file)
@@ -5027,6 +5027,10 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
        parmse->expr = build_fold_indirect_ref_loc (input_location,
                                                    parmse->expr);
 
+      bool is_artificial = (INDIRECT_REF_P (parmse->expr)
+                           ? DECL_ARTIFICIAL (TREE_OPERAND (parmse->expr, 0))
+                           : DECL_ARTIFICIAL (parmse->expr));
+
       /* Unallocated allocatable arrays and unassociated pointer arrays
         need their dtype setting if they are argument associated with
         assumed rank dummies.  */
@@ -5045,7 +5049,7 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
       type = e->ts.type != BT_ASSUMED ? gfc_typenode_for_spec (&e->ts) :
                                        NULL_TREE;
 
-      if (type && DECL_ARTIFICIAL (parmse->expr)
+      if (type && is_artificial
          && type != gfc_get_element_type (TREE_TYPE (parmse->expr)))
        {
          /* Obtain the offset to the data.  */
@@ -5057,8 +5061,7 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
                          gfc_conv_descriptor_dtype (parmse->expr),
                          gfc_get_dtype_rank_type (e->rank, type));
        }
-      else if (type == NULL_TREE
-              || (!is_subref_array (e) && !DECL_ARTIFICIAL (parmse->expr)))
+      else if (type == NULL_TREE || (!is_subref_array (e) && !is_artificial))
        {
          /* Make sure that the span is set for expressions where it
             might not have been done already.  */