[Bug fortran/55174] internal compiler error: Segmentation fault with bad array reference

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 2 02:57:00 GMT 2012


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2012-11-02 02:57:36 UTC ---
(In reply to comment #0)
> This 4-line Fortran program has an error at line 3, where array(*) is of course
> not permitted as an argument of a function.
> 
> implicit none
> integer:: array(2)=(/42,666/)
> print *, size(array(*))
> end
> 
> Other compilers (g95, ifort) correctly diagnose the error but gfortran 4.8.0 
> gives an internal compiler error: Segmentation fault and asks me to tell you.
> My compile-time output follows.
> 
> cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -v trybadstar.f90
> Driving: /local/scratch/gf/bin/gfortran -v trybadstar.f90 -l gfortran -l m
> -shared-libgcc
> Using built-in specs.
> COLLECT_GCC=/local/scratch/gf/bin/gfortran
> COLLECT_LTO_WRAPPER=/local/scratch/gf/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
> Target: i686-pc-linux-gnu
> Configured with: /local/scratch/gcc-4.8-20120701/configure
> --prefix=/local/scratch/gf --enable-languages=c,fortran --disable-libada
> --with-local-prefix=/local/scratch --with-gmp=/local/scratch
> Thread model: posix
> gcc version 4.8.0 20120701 (experimental) (GCC) 

John,

It looks like it has been fixed on trunk (aka 4.8.0).
For me, gfc4x is 4.8.0 20121002.  gfortran 4.5.x 
seems to also work, so it appears that a regression
crept in in the 4.6. development.

troutmask:sgk[209] gfc4x -o z k.f90
k.f90:2.20:

print *, size(array(*))
                    1
Error: Expected array subscript at (1)
troutmask:sgk[210] gfc47 -o z k.f90
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
troutmask:sgk[211] gfc46 -o z k.f90
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
troutmask:sgk[212] gfc45 -o z k.f90
k.f90:2.20:

print *, size(array(*))
                    1
Error: Expected array subscript at (1)

A quick scan of gcc/fortran/ChangeLog did not reveal
an obvious candidate for the revision that fixed the
problem.  We should probably add your test to the
testsuite to make sure it does not get broken, again.



More information about the Gcc-bugs mailing list