This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

internal compiler error by reexport of renamed type


Dear Fortran Developers,

First of all let me thank all of you for the great work
you did (and are doing) with the GNU Fortran compiler!
Some month ago the state of the ``gfortran art'' allowed
me to port a large home-grown quantum chemistry package
(with lots of ``abuses'' of F90 standard) to GNU tools exclusively.
The port exposed some dark corners of the implementation,
here is one of them.

Below is a 50-line demonstration for internal compiler error

> src.f90: In function ‘buggy’:
> src.f90:47: internal compiler error: in fold_convert, at fold-const.c:2025
in the case of reexport of renamed type:

The module A declares a structure with typA component.
The module B imports typA as typB and exports typB.
The module C uses a mix of typA and typB and generates internal
compiler error in some cases.

The gfortran version
> > gfortran --version
> GNU Fortran 95 (GCC) 4.1.2 20060705 (prerelease) (SUSE Linux)
> Copyright (C) 2006 Free Software Foundation, Inc.

It is not a show stopper as workarounds exist,
so consider this just an info if you have better things to do.

Alexei


!!!! declare struct atom%ofTypeA(:,:):
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]