[Bug libfortran/18924] New: segfault in dot_product with missing interface information
Thomas dot Koenig at online dot de
gcc-bugzilla@gcc.gnu.org
Fri Dec 10 13:44:00 GMT 2004
This one is a bit tricky. It passes two arrays
to a subroutine, where they are passed on to the
intrinsic function dot_product. However, they
are passed old-style, without interface information.
dot_product expects to receive only new-style arrays,
and generates a segfault in the executed program.
This one can't be caught at compile time (at least not
without inter-procedural analysis) because it's
the caller who determines wether to pass an old-style
or a new-style array.
$ cat dot_product.f90
program main
implicit none
real, dimension(2) :: a, b
real :: c
a = 1.
b = -2.3
call foo(a,b,c)
print *,c
end program main
subroutine foo(a,b,c)
real, dimension(:), intent(in) :: a, b
real, intent(out) :: c
c = dot_product(a,b)
end subroutine foo
$ gfortran dot_product.f90 && ./a.out
Segmentation fault
$ gfortran -v
Reading specs from /home/zfkts/lib/gcc/ia64-unknown-linux-gnu/4.0.0/specs
Configured with: ../gcc-4.0-20041205/configure --prefix=/home/zfkts
--enable-languages=c,c++,f95 --disable-shared
Thread model: posix
gcc version 4.0.0 20041205 (experimental)
--
Summary: segfault in dot_product with missing interface
information
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Thomas dot Koenig at online dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18924
More information about the Gcc-bugs
mailing list