re PR middle-end/41347 (ICE with -O3 or '-O2 -finline-functions')
authorMichael Matz <matz@suse.de>
Thu, 17 Sep 2009 11:11:58 +0000 (11:11 +0000)
committerMichael Matz <matz@gcc.gnu.org>
Thu, 17 Sep 2009 11:11:58 +0000 (11:11 +0000)
PR middle-end/41347
* tree.c (build_type_attribute_qual_variant): Export.
* tree.h (build_type_attribute_qual_variant): Declare.
* tree-inline.c (remap_type_1): Use it to build variants with
the original qualifiers and attributes.

testsuite/
* gfortran.dg/pr41347.f90: New test.

From-SVN: r151799

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr41347.f90 [new file with mode: 0644]
gcc/tree-inline.c
gcc/tree.c
gcc/tree.h

index 6e4f28fa624922a81e55589eebd68ec72ed53bf0..7a31855336b2bf1a4f18a4e9e0e31561fd9037c4 100644 (file)
@@ -1,3 +1,11 @@
+2009-09-17  Michael Matz  <matz@suse.de>
+
+       PR middle-end/41347
+       * tree.c (build_type_attribute_qual_variant): Export.
+       * tree.h (build_type_attribute_qual_variant): Declare.
+       * tree-inline.c (remap_type_1): Use it to build variants with
+       the original qualifiers and attributes.
+
 2009-09-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * cfglayout.c (fixup_reorder_chain): Accept conditional jumps
index 1a24f25c706c1c62cea21dcfc66825d5f99e76f1..691e328af1d72e3624a49c1fa76910d26e8da02d 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-17  Michael Matz  <matz@suse.de>
+
+       PR middle-end/41347
+       * gfortran.dg/pr41347.f90: New test.
+
 2009-09-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * gcc.c-torture/compile/20090917-1.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/pr41347.f90 b/gcc/testsuite/gfortran.dg/pr41347.f90
new file mode 100644 (file)
index 0000000..ae48857
--- /dev/null
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-options "-O3" }
+module hsl_ma41_m
+
+   implicit none
+
+   contains
+
+      subroutine solve_ma41
+         integer, dimension(20) :: info
+         call prininfo(15, info)
+      end subroutine solve_ma41
+
+      subroutine prininfo (ni, info)
+         integer, intent(in) ::  ni
+         integer, intent(in), dimension(:) :: info
+
+         integer i
+
+         call prinfo
+
+         contains
+
+            subroutine prinfo
+               do i = 1, ni
+                  write(*,'(i5,1x,i0)') i, info(i)
+               end do
+            end subroutine prinfo
+
+      end subroutine prininfo
+
+end module hsl_ma41_m
index 5ada378700fb05ab4c06b74c169bff760824e344..feb749985c23147035d9800e01e172fa9d3af244 100644 (file)
@@ -342,6 +342,10 @@ remap_type_1 (tree type, copy_body_data *id)
       new_tree = build_pointer_type_for_mode (remap_type (TREE_TYPE (type), id),
                                         TYPE_MODE (type),
                                         TYPE_REF_CAN_ALIAS_ALL (type));
+      if (TYPE_ATTRIBUTES (type) || TYPE_QUALS (type))
+       new_tree = build_type_attribute_qual_variant (new_tree,
+                                                     TYPE_ATTRIBUTES (type),
+                                                     TYPE_QUALS (type));
       insert_decl_map (id, type, new_tree);
       return new_tree;
     }
@@ -350,6 +354,10 @@ remap_type_1 (tree type, copy_body_data *id)
       new_tree = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
                                            TYPE_MODE (type),
                                            TYPE_REF_CAN_ALIAS_ALL (type));
+      if (TYPE_ATTRIBUTES (type) || TYPE_QUALS (type))
+       new_tree = build_type_attribute_qual_variant (new_tree,
+                                                     TYPE_ATTRIBUTES (type),
+                                                     TYPE_QUALS (type));
       insert_decl_map (id, type, new_tree);
       return new_tree;
     }
index d2243e5d1bd474444084e38bfd7f4d7e4d197725..846dd983ea774ccdfeb414e5b31dd3b87c74a091 100644 (file)
@@ -4034,7 +4034,7 @@ iterative_hash_host_wide_int (HOST_WIDE_INT val, hashval_t val2)
 
    Record such modified types already made so we don't make duplicates.  */
 
-static tree
+tree
 build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
 {
   if (! attribute_list_equal (TYPE_ATTRIBUTES (ttype), attribute))
index 09ce8fa125c0957fe53ea5c448c50131d6e6d5d7..afb1d4260a08a47a4eb2b408982042c77355dae4 100644 (file)
@@ -3997,6 +3997,7 @@ extern tree make_tree (tree, rtx);
 
 extern tree build_type_attribute_variant (tree, tree);
 extern tree build_decl_attribute_variant (tree, tree);
+extern tree build_type_attribute_qual_variant (tree, tree, int);
 
 /* Structure describing an attribute and a function to handle it.  */
 struct attribute_spec