OSDN Git Service

2005-11-02 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Nov 2005 21:01:54 +0000 (21:01 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Nov 2005 21:01:54 +0000 (21:01 +0000)
        PR fortran/18157
        * gfortran.fortran-torture/compile/defined_type_1.f90: New test.
        * gfortran.fortran-torture/compile/defined_type_2.f90: New
        test.
        * gfortran.fortran-torture/compile/defined_type_3.f90:
        New test.

2005-11-02  Andrew Pinski  <pinskia@physics.uc.edu>

        PR fortran/18157
        * trans-array.c (gfc_conv_resolve_dependencies): Use the correct
        type for the temporary array.
        * trans-expr.c (gfc_trans_assignment): Pass lss
        instead of lss_section
        to gfc_conv_resolve_dependencies to get the
        correct type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106396 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/defined_type_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.fortran-torture/compile/defined_type_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.fortran-torture/compile/defined_type_3.f90 [new file with mode: 0644]

index de6fed3..8589e1c 100644 (file)
@@ -1,3 +1,13 @@
+2005-11-02  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR fortran/18157
+       * trans-array.c (gfc_conv_resolve_dependencies): Use the correct
+       type for the temporary array.
+       * trans-expr.c (gfc_trans_assignment): Pass lss
+       instead of lss_section
+       to gfc_conv_resolve_dependencies to get the
+       correct type.
+
 2005-11-02  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * decl.c (gfc_match_entry): Function entries don't need an argument
index 72669f8..20d3c67 100644 (file)
@@ -2542,10 +2542,13 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
 
   if (nDepend == 1)
     {
+      tree base_type = gfc_typenode_for_spec (&dest->expr->ts);
+      if (GFC_ARRAY_TYPE_P (base_type)
+         || GFC_DESCRIPTOR_TYPE_P (base_type))
+       base_type = gfc_get_element_type (base_type);
       loop->temp_ss = gfc_get_ss ();
       loop->temp_ss->type = GFC_SS_TEMP;
-      loop->temp_ss->data.temp.type =
-       gfc_get_element_type (TREE_TYPE (dest->data.info.descriptor));
+      loop->temp_ss->data.temp.type = base_type;
       loop->temp_ss->string_length = dest->string_length;
       loop->temp_ss->data.temp.dimen = loop->dimen;
       loop->temp_ss->next = gfc_ss_terminator;
index f911487..a0339af 100644 (file)
@@ -2719,7 +2719,7 @@ gfc_trans_assignment (gfc_expr * expr1, gfc_expr * expr2)
       /* Calculate the bounds of the scalarization.  */
       gfc_conv_ss_startstride (&loop);
       /* Resolve any data dependencies in the statement.  */
-      gfc_conv_resolve_dependencies (&loop, lss_section, rss);
+      gfc_conv_resolve_dependencies (&loop, lss, rss);
       /* Setup the scalarizing loops.  */
       gfc_conv_loop_setup (&loop);
 
index 04a3342..0b9bd92 100644 (file)
@@ -1,3 +1,12 @@
+2005-11-02  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR fortran/18157
+        * gfortran.fortran-torture/compile/defined_type_1.f90: New test.
+       * gfortran.fortran-torture/compile/defined_type_2.f90: New
+       test.
+       * gfortran.fortran-torture/compile/defined_type_3.f90:
+       New test.
+
 2005-11-02  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/24569
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_1.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_1.f90
new file mode 100644 (file)
index 0000000..635727b
--- /dev/null
@@ -0,0 +1,10 @@
+!This used to ICE as we chose the wrong type for the
+! temporary to hold type%var
+! fortran/18157
+program testcase_fold
+  type :: struct                            
+     real      :: var       ! its julian sec  
+  end type struct
+  type(struct), dimension(:), pointer :: mystruct
+  mystruct(:)%var = mystruct(:)%var
+END Program testcase_fold
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_2.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_2.f90
new file mode 100644 (file)
index 0000000..29515f5
--- /dev/null
@@ -0,0 +1,17 @@
+!This used to ICE as we chose the wrong type for the
+! temporary to hold type%x
+! fortran/18157
+MODULE bug 
+ IMPLICIT NONE 
+ TYPE :: my_type 
+   REAL :: x 
+ END TYPE 
+ TYPE (my_type), DIMENSION(3) :: t 
+ CONTAINS 
+   SUBROUTINE foo 
+   INTEGER, DIMENSION(8)        :: c(3) 
+   t(c)%x = t(c)%x 
+   RETURN 
+  END SUBROUTINE foo 
+END MODULE bug 
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_3.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/defined_type_3.f90
new file mode 100644 (file)
index 0000000..d31167c
--- /dev/null
@@ -0,0 +1,10 @@
+!This used to ICE as we chose the wrong type for the
+! temporary to hold type%var
+! fortran/18157
+program testcase_fold
+  type :: struct                            
+     real      :: var       ! its julian sec  
+  end type struct
+  type(struct), dimension(:), pointer :: mystruct
+  mystruct(1:2)%var = mystruct(2:3)%var
+END Program testcase_fold