re PR fortran/18157 (ice-on-valid code, pointer to user-defined type, fold-struct.c)

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  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.

From-SVN: r106396
This commit is contained in:
Andrew Pinski 2005-11-02 21:01:54 +00:00 committed by Andrew Pinski
parent 86414779a6
commit eca18fb4b6
7 changed files with 62 additions and 3 deletions

View 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

View 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;

View 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);

View 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

View File

@ -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

View File

@ -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

View File

@ -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