[Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Mon Feb 29 21:54:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46459
--- Comment #7 from Harald Anlauf <anlauf at gmx dot de> ---
The patch of comment #1 (adjusted to current trunk) regtests cleanly
for me.
(In reply to Mikael Morin from comment #5)
> The initial test doesn't lead to a segfault any more.
>
> It is now rejected with:
> comment_0.f90:7.8:
>
> call sub(1)
> 1
> Error: Explicit interface required for 'sub' at (1): volatile argument
I think this is correct, see below (*).
>
> However, the following variant is also rejected with the same error:
>
> call sub(1)
> contains
> subroutine sub(j)
> integer, volatile :: j
> end subroutine sub
> end
I do not get any error for this case, which is correct.
(*) The requirement for an explicit interface is described in F2008,
section 12.4.2.2 (2a), and is already properly handled by
gfc_explicit_interface_required().
I threw this testcase at the Cray compiler:
% cat pr46459.f90
call sub (1)
contains
subroutine sub (j)
integer, volatile :: j
end subroutine sub
end
subroutine sub1 ()
call sub2 (1) ! { dg-error "Explicit interface required" }
end subroutine sub1
subroutine sub2 (j)
integer, volatile :: j
end subroutine sub2
subroutine sub3 ()
interface
subroutine sub2 (j)
integer, volatile :: j
end subroutine sub2
end interface
call sub2 (1)
end subroutine sub3
% ftn pr46459.f90
subroutine sub2 (j)
^
ftn-954 crayftn: ERROR SUB2, File = pr46459.f90, Line = 11, Column = 12
Procedure "SUB2", referenced at line 9 (pr46459.f90) must have an explicit
interface because one or more arguments have the VOLATILE attribute.
This would agree with the patched trunk:
pr46459.f90:9:11:
call sub2 (1) ! { dg-error "Explicit interface required" }
1
Error: Explicit interface required for 'sub2' at (1): volatile argument
More information about the Gcc-bugs
mailing list