This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Apr 2013 17:32:11 +0200
- Subject: Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- References: <CAKwh3qiaKALyvJnMHrGMo1P0suzxim+CXy=9VykJ1DRfN1hb5g at mail dot gmail dot com> <5161BB3C dot 30203 at net-b dot de> <CAKwh3qjxZJ0toSS7yGb90+3jP3XYEvnoQu1rrWe68zL3ZYEY0Q at mail dot gmail dot com> <5161D100 dot 5030205 at net-b dot de> <CAKwh3qjan_X6r0e_Kiv7-O_3VquZ2qU4BBoQ6kOg784ma_5RsQ at mail dot gmail dot com> <51659652 dot 60705 at net-b dot de> <CAKwh3qik3LJKKqNvwF+_GmORUnXiuBmcTGHHbY+RSurfcJX4hA at mail dot gmail dot com> <CAKwh3qjthydw=nghLXOC3x0zd24Q8tDus4+e7iqS0rbzR4E9AQ at mail dot gmail dot com>
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
- References:
- [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array
- Re: [Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array