public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31148] New: optional argument of elemental function
@ 2007-03-12 15:41 vivekrao4 at yahoo dot com
2007-03-18 17:49 ` [Bug fortran/31148] " fxcoudert at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-03-12 15:41 UTC (permalink / raw)
To: gcc-bugs
Since ivec is not passed to sub, I think the two calls
to set_optional should be equivalent, but gfortran crashes
upon the second call.
u:\vrao\fortran type xopt_bug.f90
module sub_mod
contains
elemental subroutine set_optional(i,idef,iopt)
! set i to (iopt,idef) if iopt (is,is not) PRESENT
integer, intent(out) :: i
integer, intent(in) :: idef
integer, intent(in), optional :: iopt
if (present(iopt)) then
i = iopt
else
i = idef
end if
end subroutine set_optional
!
subroutine sub(ivec)
integer , intent(in), optional :: ivec(:)
integer :: ivec_(2)
call set_optional(ivec_,(/1,2/))
print*,"ivec_=",ivec_
call set_optional(ivec_,(/1,2/),ivec)
print*,"ivec_=",ivec_
end subroutine sub
end module sub_mod
program main
use sub_mod, only: sub
call sub()
end program main
U:\vrao\fortran>gfortran -v
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/coudert/local --disable-nls
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --host=i386-pc-mingw32 --disable-shared
--enable-libgomp
Thread model: win32
gcc version 4.3.0 20061021 (experimental)
U:\vrao\fortran>gfortran -W -Wall -pedantic-errors -std=f2003 -fbounds-check
-Werror xopt_bug.f90
U:\vrao\fortran>a.exe
Fortran runtime error: Array bound mismatch, size mismatch for dimension 1 of
array 'ivec' (in file 'xopt_bug.f90', at line 20)
ivec_= 1 2
--
Summary: optional argument of elemental function
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vivekrao4 at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31148
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/31148] optional argument of elemental function
2007-03-12 15:41 [Bug fortran/31148] New: optional argument of elemental function vivekrao4 at yahoo dot com
@ 2007-03-18 17:49 ` fxcoudert at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-18 17:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2007-03-18 17:49 -------
Summary of what other compilers do:
- gfortran-compiled code runs OK without -fbounds-check, issue runtime error
with -fbounds-check
- intel-compiled code runs OK, but segfaults with -check all
- sun-compiled code segfaults whether you use -C or not
- g95 runs OK with and without checking
I think it's a gfortran -fbounds-check bug, and it seems to be a duplicate of
PR 31119. <FX looks to be sure. He realizes it's the exact same code. Stupid
me, should have looked earlier.>
*** This bug has been marked as a duplicate of 31119 ***
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31148
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-18 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-12 15:41 [Bug fortran/31148] New: optional argument of elemental function vivekrao4 at yahoo dot com
2007-03-18 17:49 ` [Bug fortran/31148] " fxcoudert at gcc dot gnu dot org
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).