public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32319] New: Bad automatic array argument
@ 2007-06-13 15:29 terry at chem dot gu dot se
2007-06-13 15:57 ` [Bug fortran/32319] " dfranke at gcc dot gnu dot org
2007-06-13 16:11 ` terry at chem dot gu dot se
0 siblings, 2 replies; 3+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 15:29 UTC (permalink / raw)
To: gcc-bugs
[tjf@fkpc167]$ cat run.f90
subroutine aa(v)
integer,dimension(:),intent(out)::v
write(*,*)size(v)
v=0
end subroutine aa
program ff
implicit none
integer,dimension(10)::w
w=1
write(*,*)w
call aa(w(1:5))
write(*,*)w
end
[tjf@fkpc167]$ gfortran -Wall -W -fbounds-check -O --std=f95 --pedantic -v
run.f90
Driving: gfortran -Wall -W -fbounds-check -O -std=f95 -pedantic -v run.f90
-lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=fortran
Thread model: posix
gcc version 4.2.0 20070501 (prerelease)
/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 run.f90 -quiet
-dumpbase run.f90 -mtune=generic -auxbase run -O -Wall -W -pedantic -std=f95
-version -fbounds-check -I
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude -o /tmp/cc6lORdO.s
GNU F95 version 4.2.0 20070501 (prerelease) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.2.0 20070501 (prerelease).
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=112193
as --traditional-format -V -Qy -o /tmp/ccyEdACx.o /tmp/cc6lORdO.s
GNU assembler version 2.17.50 (x86_64-linux-gnu) using BFD version 2.17.50
20070103 Ubuntu
/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/collect2 --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtbegin.o
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/../../.. /tmp/ccyEdACx.o
-lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/crtend.o
/usr/lib/../lib64/crtn.o
[tjf@fkpc167]$ ./a.out
1 1 1 1 1 1
1 1 1 1
-1762200976
Segmentation fault
This has really surprised me, as I'd swear I've used this construct recently.
So much so, I even went and upgraded my gcc just to test it!
(In case anyone cares, I was in the process of testing some of the implications
of not having PR32317 implemented with array sections and vector subscripts and
the like. Clearly, I never got that far!)
--
Summary: Bad automatic array argument
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: terry at chem dot gu dot se
GCC host triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32319
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/32319] Bad automatic array argument
2007-06-13 15:29 [Bug fortran/32319] New: Bad automatic array argument terry at chem dot gu dot se
@ 2007-06-13 15:57 ` dfranke at gcc dot gnu dot org
2007-06-13 16:11 ` terry at chem dot gu dot se
1 sibling, 0 replies; 3+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-13 15:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dfranke at gcc dot gnu dot org 2007-06-13 15:57 -------
If you would provide an explicit interface for AA, the binary would not
segfault:
$> cat pr32319.f90
program ff
implicit none
integer,dimension(4)::w
w=1
write(*,*)w
call aa(w(2:3))
write(*,*)w
contains
subroutine aa(v)
integer,dimension(:),intent(out)::v
write(*,*)size(v)
v=0
end subroutine aa
end
$> gfortran-svn pr32319.f90 && ./a.out
1 1 1 1
2
1 0 0 1
Without explicit interface, the binary produced by ifort crashes the same way
as the one generated by gfortran, sunf95 issues this message on the original
code:
$> sunf95 -w4 pr32319.f90
call aa(w(1:5))
^
"pr32319.f90", Line = 13, Column = 1: ERROR: Procedure "AA" is defined at line
1 (pr32319.f90). It must have an explicit interface specified.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32319
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/32319] Bad automatic array argument
2007-06-13 15:29 [Bug fortran/32319] New: Bad automatic array argument terry at chem dot gu dot se
2007-06-13 15:57 ` [Bug fortran/32319] " dfranke at gcc dot gnu dot org
@ 2007-06-13 16:11 ` terry at chem dot gu dot se
1 sibling, 0 replies; 3+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 16:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from terry at chem dot gu dot se 2007-06-13 16:10 -------
Ah. Of course explicit interfaces are required for automatic array arguments.
My Fortran-Fu seems to be deserting me at the moment. :-(
--
terry at chem dot gu dot se changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32319
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-13 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13 15:29 [Bug fortran/32319] New: Bad automatic array argument terry at chem dot gu dot se
2007-06-13 15:57 ` [Bug fortran/32319] " dfranke at gcc dot gnu dot org
2007-06-13 16:11 ` terry at chem dot gu dot se
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).