This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array


Am 11.04.2013 23:38, schrieb Janus Weil:
2013/4/11 Tobias Burnus <burnus@net-b.de>:
Comment to Janus: It should be possible to disable the error check, e.g. by making it a warning. That's actually what the current code does: By default,
it only warns and does not print an error.
No, at least the type mismatch and char-len checks always seem to
throw an error ...

Only for function-result types:
  Error: Return type mismatch of function 'foo' at (1) (REAL(4)/COMPLEX(4))

But not for arguments:

subroutine foo(x)
  complex x(2)
end subroutine foo

real :: r(4)
call foo(r)
end

Warning: Type mismatch in argument 'x' at (1); passed REAL(4) to COMPLEX(4)


That's also how NAG's "f95 -dirty" handles it.

Thus, I think one should be strict about the requires-explicit-interface
diagnostic (= new code, using F90+), but for interface mismatch (= could be
old Fortran 66 code),  it should be either disabled or - as currently - just
be a warning.
How about enabling it by default, but having -std=legacy disable the checks?

Hmm, I think I'd prefer to have for the arguments only a warning with -std=gnu - except for the function result value, which should always be an error. And also the "requires an explicit interface" checks should always use an error.

However, if one goes for an error with -std=gnu, the error should explicitly mention that "-std=legacy" disables the error. At least I do not recall all the special flags which enable certain features, nor whether such a flag exists at all. And I doubt that a normal user do.

(Actually, we already got bug reports about rejected code where the message explicitly stated after the error "This check can be disabled with the option -fno-range-check". Thus, some users do not even read the error message carefully.)

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]