This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/15494] New: [gfortran] ICE on valid code, array of strings


The following code causes current gfortran to crash with an ICE:

module linebufmod
implicit none
private

public linebuf, linebuf_add

type linebuf
  character(len=80), dimension(:), pointer :: data=>NULL()
  integer :: size=0
end type linebuf

contains

subroutine linebuf_add (buf, line)
  type(linebuf), intent(inout) :: buf
  character(len=*), intent(in) :: line

  character(len=80), dimension(:), pointer :: data2

data2=>NULL()

  if (.not. associated(buf%data)) allocate(buf%data(10))

  if (size(buf%data)==buf%size) then
    allocate (data2(2*size(buf%data)))
    data2(1:size(buf%data)) = buf%data
    deallocate (buf%data)
    buf%data => data2
  endif

  buf%size=buf%size+1
  buf%data(buf%size) = trim (line)
end subroutine linebuf_add

end module linebufmod


~/tmp>gfortran -v -c bug.f90
Reading specs from /afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: /scratch/gcc/configure --quiet
--prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,f95
--with-gmp=/afs/mpa/data/martin/mygmp --disable-checking
Thread model: posix
gcc version 3.5.0 20040517 (experimental)
 /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/3.5.0/f951 bug.f90
-quiet -dumpbase bug.f90 -mtune=pentiumpro -auxbase bug -version -o /tmp/cceuAkva.s
GNU F95 version 3.5.0 20040517 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.5.0 20040517 (experimental).
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63317
f951: /scratch/gcc/gcc/fortran/trans-expr.c:1590: gfc_trans_scalar_assign:
Assertion `lse->string_length != (tree) ((void *)0) && rse->string_length !=
(tree) ((void *)0)' failed.
bug.f90: In function `linebuf_add':
bug.f90:26: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

-- 
           Summary: [gfortran] ICE on valid code, array of strings
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: martin at mpa-garching dot mpg dot de
                CC: gcc-bugs at gcc dot gnu dot org,martin at mpa-garching
                    dot mpg dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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