internal compiler error in gfortran

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

internal compiler error in gfortran

Dirk Fressmann
Hi there,

the attached F90 code segments produce internal compiler errors

System: Fedora Core 4 Linux, i386, Kernel 2.6.11-1.1369 on an
        IBM Thinkpad T41p, Intel(R) Pentium(R) M processor 1700MHz

last tested gfortran version
> gfortran -v
Using built-in specs.
Target: i386-linux
Configured with: ../gcc/configure --prefix=/tmp/gfortran-20050619/irun
--enable-languages=c,f95 --host=i386-linux
Thread model: posix
gcc version 4.1.0 20050619 (experimental)

but the same errors were produced by all gfortran versions in the last
3 months.

1st example (from HSL2000-Harwell Subroutine Library):
----------------------------------------------------------------------
MODULE HSL_ZD01_char
  IMPLICIT NONE
CONTAINS
  FUNCTION ZD01_get(array)
    CHARACTER :: array(:)
    CHARACTER(size(array)) ::  ZD01_get
    integer :: i
    do i = 1, size(array)
       ZD01_get(i:i) = array(i)
    end do
  END FUNCTION ZD01_get
END MODULE HSL_ZD01_char
----------------------------------------------------------------------
OUTPUT:
> gfortran -c file.f90
file.f90: In function ?zd01_get?:
file.f90:5: internal compiler error: in gfc_finish_var_decl, at
fortran/trans-decl.c:435
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.



2nd example
----------------------------------------------------------------------
module try
contains
  function trans(string)
    character(len=*), intent(in) :: string
    character(len=len(string))   :: trans
    character(len=*), parameter :: inpset='abcd'
    character(len=*), parameter :: outset='DCBA'
    integer  :: i,k
    do i=1,len(string)
      k = index(inpset,string(i:i))
      if (k /=0 ) then
        trans(i:i) = outset(k:k)
      else
        trans(i:i) = string(i:i)
      end if
    enddo
  end function trans
end module try
----------------------------------------------------------------------
OUTPUT
> gfortran -c try.f90
try.f90: In function ?trans?:
try.f90:15: internal compiler error: in gfc_finish_var_decl, at
fortran/trans-decl.c:435
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.



--
Dr.-Ing. Dirk Fressmann
Department of Civil-, Surveying- and
Environmental Engineering
The University of Newcastle
Callaghan, Australia 2308

Ph: +61 2 4921 6082
Email: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: internal compiler error in gfortran

Steve Kargl
Thanks for the bug report.  This is or is related to PR 18883.

--
Steve
Reply | Threaded
Open this post in threaded view
|

Re: internal compiler error in gfortran

Paul Thomas-10
In reply to this post by Dirk Fressmann
This is PR15326, which is the next on my list of character related bugs.
 I have been working on it sporadically for a few weeks.

Up to a minor nasty in multiple declarations, two things need to be done:

(i) The returned string needs to be allocated space.  This is relatively
easy because anything other than a return value is treated correctly.
(ii) More seriously, the character length needs to be returned to the
caller.  This requires some non-trivial surgery to function calls that I
just have not successfully accomplished yet.

I am onto it, though!

Paul T