mirror of git://gcc.gnu.org/git/gcc.git
re PR fortran/62044 (ICE in USE statement with RENAME for extended derived type)
2015-01-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/62044 * resolve.c (resolve_allocate_expr): If the default initializer is NULL, keep the original MOLD expression so that the correct typespec is available. 2015-01-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/62044 * gfortran.dg/allocate_with_mold_1.f90: New test From-SVN: r220140
This commit is contained in:
parent
1b7706c830
commit
40a778bd51
|
|
@ -1,3 +1,10 @@
|
||||||
|
2015-01-26 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/62044
|
||||||
|
* resolve.c (resolve_allocate_expr): If the default initializer
|
||||||
|
is NULL, keep the original MOLD expression so that the correct
|
||||||
|
typespec is available.
|
||||||
|
|
||||||
2015-01-26 Tobias Burnus <burnus@net-b.de>
|
2015-01-26 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
PR fortran/64771
|
PR fortran/64771
|
||||||
|
|
|
||||||
|
|
@ -6995,10 +6995,13 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
|
||||||
{
|
{
|
||||||
/* Default initialization via MOLD (non-polymorphic). */
|
/* Default initialization via MOLD (non-polymorphic). */
|
||||||
gfc_expr *rhs = gfc_default_initializer (&code->expr3->ts);
|
gfc_expr *rhs = gfc_default_initializer (&code->expr3->ts);
|
||||||
|
if (rhs != NULL)
|
||||||
|
{
|
||||||
gfc_resolve_expr (rhs);
|
gfc_resolve_expr (rhs);
|
||||||
gfc_free_expr (code->expr3);
|
gfc_free_expr (code->expr3);
|
||||||
code->expr3 = rhs;
|
code->expr3 = rhs;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (e->ts.type == BT_CLASS && !unlimited && !UNLIMITED_POLY (code->expr3))
|
if (e->ts.type == BT_CLASS && !unlimited && !UNLIMITED_POLY (code->expr3))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-01-26 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/62044
|
||||||
|
* gfortran.dg/allocate_with_mold_1.f90: New test
|
||||||
|
|
||||||
2015-01-26 Jakub Jelinek <jakub@redhat.com>
|
2015-01-26 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR c/64778
|
PR c/64778
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
! { dg-do run }
|
||||||
|
!
|
||||||
|
! Fixes a bug that emerged from the fix of PR62044 - see the PR. When
|
||||||
|
! there was no default initializer, code-expr3 was set null and so the
|
||||||
|
! vpointer was set to the vtable of the declared type, rather than that
|
||||||
|
! of the MOLD expression.
|
||||||
|
!
|
||||||
|
! Contributed by but based on the original PR62044 testcase by
|
||||||
|
! Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
!
|
||||||
|
module GridImageSilo_Template
|
||||||
|
implicit none
|
||||||
|
type, public, abstract :: GridImageSiloTemplate
|
||||||
|
end type GridImageSiloTemplate
|
||||||
|
end module GridImageSilo_Template
|
||||||
|
|
||||||
|
module UnstructuredGridImageSilo_Form
|
||||||
|
use GridImageSilo_Template
|
||||||
|
implicit none
|
||||||
|
type, public, extends ( GridImageSiloTemplate ) :: &
|
||||||
|
UnstructuredGridImageSiloForm
|
||||||
|
end type UnstructuredGridImageSiloForm
|
||||||
|
end module UnstructuredGridImageSilo_Form
|
||||||
|
|
||||||
|
module UnstructuredGridImages
|
||||||
|
use UnstructuredGridImageSilo_Form, &
|
||||||
|
UnstructuredGridImageForm => UnstructuredGridImageSiloForm
|
||||||
|
contains
|
||||||
|
subroutine foo
|
||||||
|
class (GridImageSiloTemplate), allocatable :: a
|
||||||
|
type (UnstructuredGridImageForm) :: b
|
||||||
|
integer :: i = 0
|
||||||
|
allocate (a, mold = b)
|
||||||
|
select type (a)
|
||||||
|
type is (UnstructuredGridImageForm)
|
||||||
|
i = 1
|
||||||
|
class default
|
||||||
|
i = 2
|
||||||
|
end select
|
||||||
|
if (i .ne. 1) call abort
|
||||||
|
end subroutine
|
||||||
|
end module UnstructuredGridImages
|
||||||
|
|
||||||
|
use UnstructuredGridImages
|
||||||
|
call foo
|
||||||
|
end
|
||||||
|
|
||||||
Loading…
Reference in New Issue