$ cat a.f90
module modA
implicit none
save
private

type, public :: typA
integer :: i
end type typA

type, public :: atom
type(typA), pointer :: ofTypA(:,:)
end type atom
end module modA

!!! re-name and re-export typA as typB:
module modB
use modA, only: typB => typA
implicit none
save
private

public typB
end module modB

!!! mixed used of typA and typeB:
module modC
use modB
implicit none
save
private
contains

subroutine buggy(a)
use modA, only: atom
! use modB, only: typB
! use modA, only: typA
implicit none
type(atom),intent(inout) :: a
target :: a
! *** end of interface ***

type(typB), pointer :: ofTypB(:,:)
! type(typA), pointer :: ofTypB(:,:)
integer :: i,j,k

ofTypB => a%ofTypA

a%ofTypA(i,j) = ofTypB(k,j)
end subroutine buggy
end module modC

$ gfortran -c a.f90
a.f90: In function ‘buggy’:
a.f90:47: internal compiler error: in fold_convert, at fold-const.c:2098


The backtrace is:

Breakpoint 1, fancy_abort (file=0x85d6e64 "../../../trunk/gcc/fold-const.c",
    line=2098, function=0x85d6dda "fold_convert")
    at ../../../trunk/gcc/diagnostic.c:641
641     {
(gdb) where
#0  fancy_abort (file=0x85d6e64 "../../../trunk/gcc/fold-const.c", line=2098,
    function=0x85d6dda "fold_convert") at ../../../trunk/gcc/diagnostic.c:641
#1  0x082240be in fold_convert (type=0xb7be9508, arg=0xb7b960dc)
    at ../../../trunk/gcc/fold-const.c:2098
#2  0x080beb27 in gfc_trans_scalar_assign (lse=0xbfc20674, rse=0xbfc2064c,
    type=BT_DERIVED) at ../../../trunk/gcc/fortran/trans-expr.c:3064
#3  0x080c41ec in gfc_trans_assignment (expr1=0x873ffb0, expr2=0x8740af8)
    at ../../../trunk/gcc/fortran/trans-expr.c:3253
#4  0x080c4449 in gfc_trans_assign (code=0x8740d50)
    at ../../../trunk/gcc/fortran/trans-expr.c:3305
#5  0x080aa814 in gfc_trans_code (code=0x8740d50)
    at ../../../trunk/gcc/fortran/trans.c:469
#6  0x080bc8de in gfc_generate_function_code (ns=0x873f9d8)
    at ../../../trunk/gcc/fortran/trans-decl.c:2982
#7  0x080a9f48 in gfc_generate_module_code (ns=0x872a520)
    at ../../../trunk/gcc/fortran/trans.c:685
#8  0x08088b20 in gfc_parse_file () at ../../../trunk/gcc/fortran/parse.c:3223
#9  0x080a991d in gfc_be_parse_file (set_yydebug=0)
    at ../../../trunk/gcc/fortran/f95-lang.c:303
#10 0x0839d94a in toplev_main (argc=13, argv=0xbfc208f4)
    at ../../../trunk/gcc/toplev.c:999
#11 0x080dd56f in main (argc=-1212544056, argv=0x0)
    at ../../../trunk/gcc/main.c:35


-- 
           Summary: ICE on reexport of renamed type
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28601

Reply via email to