This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33343] New: ICE (segfault) on invalid code with wrongly shaped arguments to elemental procedures
- From: "mikael dot morin at tele2 dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Sep 2007 22:37:59 -0000
- Subject: [Bug fortran/33343] New: ICE (segfault) on invalid code with wrongly shaped arguments to elemental procedures
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following invalid program produces an ICE with gfortran (4.3 and 4.2.1).
The program does not ICEs if we replace the invalid line by one of the (valid)
commented lines.
If we don't use automatic arrays (ie we use dimension(length) instead of
dimension(size(vectors)), there is no ICE either.
$ cat test15.f
module geometry
implicit none
integer, parameter :: prec = 8
integer, parameter :: length = 10
contains
elemental function Mul(a, b)
real(kind=prec) :: a
real(kind=prec) :: b, Mul
intent(in) :: a, b
Mul = a * b
end function Mul
pure subroutine calcdAcc2(vectors, angles)
real(kind=prec), dimension(:) :: vectors
real(kind=prec), dimension(size(vectors),2) :: angles
intent(in) :: vectors, angles
real(kind=prec), dimension(size(vectors)) :: ax
real(kind=prec), dimension(size(vectors),2) :: tmpAcc
! tmpAcc(1,:) = Mul(angles(1,1:2),ax(1))
! tmpAcc(:,1) = Mul(angles(:,1),ax)
tmpAcc(:,:) = Mul(angles(:,:),ax)
end subroutine calcdAcc2
end module geometry
$ /usr/local/bin/gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-svn/gcc/configure --enable-languages=c,fortran
CFLAGS='-g -O0'
Thread model: posix
gcc version 4.3.0 20070906 (experimental) (GCC)
Here is the backtrace from gdb :
(gdb) bt
#0 integer_onep (expr=0x0) at ../../gcc-svn/gcc/gcc/tree.c:1337
#1 0x080d0543 in gfc_conv_loop_setup (loop=0xbf9fed24)
at ../../gcc-svn/gcc/gcc/fortran/trans-array.c:3250
#2 0x080e653a in gfc_trans_assignment_1 (expr1=0x894fed8, expr2=0x8950d10,
init_flag=0 '\0') at ../../gcc-svn/gcc/gcc/fortran/trans-expr.c:3972
#3 0x080e6a55 in gfc_trans_assignment (expr1=0x894fed8, expr2=0x8950d10,
init_flag=36 '$') at ../../gcc-svn/gcc/gcc/fortran/trans-expr.c:4152
#4 0x080e77b1 in gfc_trans_assign (code=0x8950678)
at ../../gcc-svn/gcc/gcc/fortran/trans-expr.c:4164
#5 0x080c7552 in gfc_trans_code (code=0x8950678)
at ../../gcc-svn/gcc/gcc/fortran/trans.c:970
#6 0x080de492 in gfc_generate_function_code (ns=0x894f5f0)
at ../../gcc-svn/gcc/gcc/fortran/trans-decl.c:3258
#7 0x080c49ca in gfc_generate_module_code (ns=0x894d8c0)
at ../../gcc-svn/gcc/gcc/fortran/trans.c:1190
#8 0x080991e6 in gfc_parse_file ()
at ../../gcc-svn/gcc/gcc/fortran/parse.c:3316
#9 0x080c027d in gfc_be_parse_file (set_yydebug=0)
at ../../gcc-svn/gcc/gcc/fortran/f95-lang.c:300
#10 0x083455c0 in toplev_main (argc=13, argv=0xbf9ff284)
at ../../gcc-svn/gcc/gcc/toplev.c:1045
#11 0x08108ccf in main (argc=-1212132032, argv=0x0)
at ../../gcc-svn/gcc/gcc/main.c:35
Thank you guys for all the great work you do :)
--
Summary: ICE (segfault) on invalid code with wrongly shaped
arguments to elemental procedures
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mikael dot morin at tele2 dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33343