This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31292] New: ICE with module procedure interface in a procedure body
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Mar 2007 10:24:29 -0000
- Subject: [Bug fortran/31292] New: ICE with module procedure interface in a procedure body
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program is taken from
http://home.comcast.net/%7Ekmbtib/Fortran_stuff/fire.f90
The is_g95 check returns T for g95 and NAG f95 and F for ifort 9.1 and sunf95.
I believe it should return TRUE by the standard.
Running the program through valgrind shows:
==317== Invalid read of size 1
==317== at 0x41EC17: check_interface0 (interface.c:918)
==317== by 0x41F88A: gfc_check_interfaces (interface.c:1086)
...
==317== Invalid read of size 8
==317== at 0x41EC7E: check_interface0 (interface.c:920)
==317== by 0x41F88A: gfc_check_interfaces (interface.c:1086)
......
fire2.f90:12.37:
module procedure assign_t
1
Error: Procedure 'assign_t' in intrinsic assignment operator at (1) is neither
function nor subroutine.
(Without using valgrind this crashes and gives an ICE -> ice-on-valid-code.)
If one changes the order of "is_g95" and "assign_t", no invalid read occurs but
the same error message is printed. (-> rejects-valid)
If one moves the interface from the subroutine to before the contains line, it
compiles and prints T. (-> good code; ifort still prints "F")
Please check afterwards whether also the big program "fire.f90" compiles and
runs.
! Based on:
! http://home.comcast.net/%7Ekmbtib/Fortran_stuff/fire.f90
module chk_g95
implicit none
type t
integer x
end type t
contains
function is_g95()
logical is_g95
interface assignment(=)
module procedure assign_t
end interface assignment(=)
type(t) y(3)
y%x = (/1,2,3/)
y = y((/2,3,1/))
is_g95 = y(3)%x == 1
end function is_g95
elemental subroutine assign_t(lhs,rhs)
type(t), intent(in) :: rhs
type(t), intent(out) :: lhs
lhs%x = rhs%x
end subroutine assign_t
end module chk_g95
program fire
use chk_g95
implicit none
print *, is_g95()
if(.not. is_g95()) call abort()
end program fire
--
Summary: ICE with module procedure interface in a procedure body
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code, rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31292