Am 11.04.2013 16:23, schrieb Janus Weil:
[Btw, I also thought about doing a full "gfc_compare_interfaces" in
"resolve_global_procedure", but that would probably be too strict.]
Comment to self: It's certainly more strict, but I think this is a
good thing. I just tried it and in fact it catches a number of cases
in the testsuite, which previously went unnoticed.
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. Even the very picky
NAG compiler allows (at least some) mismatches with -dirty. Cf.
http://gcc.gnu.org/ml/fortran/2009-05/msg00253.html for one example.
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.
Having a mismatch is invalid according to the standard, but I think we
should continue to support old code (which might contain some
mismatches); on the other hand, warning about mismatches should be done.
(See gfc_errors_to_warnings calls in resolve_global_procedure.)
* * *
Regarding your other patch - I haven't looked at the current patch:
- l1 = mpz_get_si (cl1->length->value.integer);
+ case -2:
+ /* FIXME: Implement a warning for this case. */
+ break;
I don't think that a warning makes sense:
function foo(n)
character(len=n) :: foo
...
interface
function foo(m)
character(len=m) :: foo
looks perfectly valid but since m /= n, the dependency analysis will return -2. And I do not want
to have a warning for it. As the values are magic numbers, please add a comment above
"case:" to roughly explain what the value means, especially for "-2", for
-1/1/-3 one could guess it.
+ default:
+ gfc_internal_error ("resolve_global_procedure: Unexpected "
+ "result %i of gfc_dep_compare_expr",
+ compval);
+ break;
Since it is unlikely to be hit: gcc_unreachable (); should do. It makes
the file size smaller, avoids work for translators, and one already gets
a backtrace for it.
Tobias