diff mbox series

[committed] PR 92208 + PR 92277 – GCC 9 follow-up fix

Message ID 61238c24-29d9-262a-fefb-0673d5f77ee6@net-b.de
State New
Headers show
Series [committed] PR 92208 + PR 92277 – GCC 9 follow-up fix | expand

Commit Message

Tobias Burnus Nov. 5, 2019, 2:41 p.m. UTC
For trunk, I needed the DECL_ARTIFICIAL fix, cf. Rev. 277661 of PR92277, 
i.e. https://gcc.gnu.org/ml/gcc-patches/2019-10/msg02148.html

When back-porting some patches, I did not include this part – only its 
test case – as I couldn't trigger the ICE. Well, as the comments in PR 
92208 show, the issue is also latent on GCC 9, but it only triggers on 
arm and aarch64.

Hence, I have now applied also the code change from PR 92277.

Committed as Rev. 277840.

Cheers,

Tobias
diff mbox series

Patch

commit 41957bfcc2982ba3e3d047f95cffc39e468a0904
Author: burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Nov 5 14:28:07 2019 +0000

    PR 92208 + PR 92277 – GCC 9 follow-up fix
    
            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.
    
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277840 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e8ab85fc424..a9369691722 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 245e656a1f8..52a8cdd6902 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -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.  */