[Bug fortran/47448] New: Accepts invalid ASSIGNMENT(=) which overrides intrinsic assignment
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 24 21:40:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47448
Summary: Accepts invalid ASSIGNMENT(=) which overrides
intrinsic assignment
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid, diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
bd satish shows at http://gcc.gnu.org/ml/fortran/2011-01/msg00209.html an
example, which is accepted but invalid:
interface assignment(=)
module procedure return_char_array
end interface
contains
subroutine return_char_array(outstr,instr)
character, allocatable, intent(out) :: outstr(:)
character(len=*), intent(in) :: instr
The issue is that this interface would override an intrinsic assignment, which
is not allowed. Or in word of the Fortran 2008 standard on "12.4.3.4.3 Defined
assignments":
"The first argument shall have INTENT (OUT) or INTENT (INOUT) and the second
argument shall have INTENT (IN). Either the second argument shall be an array
whose rank di
ers from that of the first argument, the declared types and kind
type parameters of the arguments shall not conform as specified in Table 7.8,
or the first argument shall be of derived type."
As those constraints do not have a C number, the compiler is not required to
diagnose this, but as quality of implementation it should.
Other compilers:
- g95: Error: Operator interface at (1) conflicts with the intrinsic operation
- PathScale: Error: This specific interface "RETURN_CHAR_ARRAY" conflicts with
the intrinsic use of "=".
NAG shows a completely bogus error and ifort compiles and used the defined
interface.
More information about the Gcc-bugs
mailing list