re PR fortran/45586 (ICE non-trivial conversion at assignment)
authorTobias Burnus <burnus@net-b.de>
Wed, 27 Jul 2011 22:33:00 +0000 (00:33 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 27 Jul 2011 22:33:00 +0000 (00:33 +0200)
2011-07-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45586
        * trans-types.c (gfc_get_derived_type): Ensure that pointer
        component types are marked as nonrestricted.

2011-07-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45586
        * gfortran.dg/lto/pr45586-2_0.f90: New.

From-SVN: r176852

gcc/fortran/ChangeLog
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90 [new file with mode: 0644]

index a2614a046728b7a80bbcb9ee1697de4877b21540..275285e5360ded1ced64eb59aea37e390e5c9403 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/45586
+       * trans-types.c (gfc_get_derived_type): Ensure that pointer
+       component types are marked as nonrestricted.
+
 2011-07-27  Daniel Carrera  <dcarrera@gmail.com>
 
        PR fortran/49755
index b66941f366a88d5da9bc3ecd30369f32739147eb..bec2a116752bb144e86e501d0df8d981848f3d97 100644 (file)
@@ -2421,6 +2421,9 @@ gfc_get_derived_type (gfc_symbol * derived)
               && !c->attr.proc_pointer)
        field_type = build_pointer_type (field_type);
 
+      if (c->attr.pointer)
+       field_type = gfc_nonrestricted_type (field_type);
+
       /* vtype fields can point to different types to the base type.  */
       if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.vtype)
          field_type = build_pointer_type_for_mode (TREE_TYPE (field_type),
index b4f95b5a9559f8b00fbb2b42f741279b118ce308..485057f80a28063db89e7b5895f662bc3928ec55 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/45586
+       * gfortran.dg/lto/pr45586-2_0.f90: New.
+
 2011-07-27  Aldy Hernandez  <aldyh@redhat.com>
 
        PR middle-end/49875
diff --git a/gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90
new file mode 100644 (file)
index 0000000..52e2bb1
--- /dev/null
@@ -0,0 +1,34 @@
+! { dg-lto-do link }
+!
+! PR fortran/45586 (comment 53)
+!
+
+MODULE M1
+  INTEGER, PARAMETER :: dp=8
+  TYPE realspace_grid_type
+     REAL(KIND=dp), DIMENSION ( :, :, : ), ALLOCATABLE :: r
+  END TYPE realspace_grid_type
+  TYPE realspace_grid_p_type
+     TYPE(realspace_grid_type), POINTER :: rs_grid
+  END TYPE realspace_grid_p_type
+  TYPE realspaces_grid_p_type
+     TYPE(realspace_grid_p_type), DIMENSION(:), POINTER :: rs
+  END TYPE realspaces_grid_p_type
+END MODULE
+
+MODULE M2
+ USE M1
+CONTAINS
+ SUBROUTINE S1()
+  INTEGER :: i,j
+  TYPE(realspaces_grid_p_type), DIMENSION(:), POINTER :: rs_gauge
+  REAL(dp), DIMENSION(:, :, :), POINTER    :: y
+  y=>rs_gauge(i)%rs(j)%rs_grid%r
+ END SUBROUTINE
+END MODULE
+
+USE M2
+  CALL S1()
+END
+
+! { dg-final { cleanup-modules "m1 m2" } }