[Patch, fortran] [2/5] PR 45586: Use distinct types to have per field qualified types.

Mikael Morin mikael.morin@sfr.fr
Fri Aug 24 15:12:00 GMT 2012


This patch comes from Richi. Self explanatory.

OK?
-------------- next part --------------
2012-08-22  Richard Guenther  <rguenther@suse.de>

	PR fortran/45586
	* trans-expr.c (gfc_nonrestricted_type): Make the non-restrict type
	distinct from the original type.

-------------- next part --------------
diff --git a/trans-types.c b/trans-types.c
index a6e5d99..189f597 100644
--- a/trans-types.c
+++ b/trans-types.c
@@ -2026,7 +2026,8 @@ gfc_nonrestricted_type (tree t)
 	    ret = t;
 	  else
 	    {
-	      ret = build_variant_type_copy (t);
+	      ret = build_distinct_type_copy (t);
+	      TYPE_CANONICAL (ret) = TYPE_CANONICAL (t);
 	      TREE_TYPE (ret) = elemtype;
 	      if (TYPE_LANG_SPECIFIC (t)
 		  && GFC_TYPE_ARRAY_DATAPTR_TYPE (t))
@@ -2070,7 +2071,8 @@ gfc_nonrestricted_type (tree t)
 	      }
 	  if (!field)
 	    break;
-	  ret = build_variant_type_copy (t);
+	  ret = build_distinct_type_copy (t);
+	  TYPE_CANONICAL (ret) = TYPE_CANONICAL (t);
 	  TYPE_FIELDS (ret) = NULL_TREE;
 
 	  /* Here we make sure that as soon as we know we have to copy


More information about the Fortran mailing list