[Patch, Fortran] PR 85599: warn about short-circuiting of logical expressions for non-pure functions

Janus Weil janus@gcc.gnu.org
Tue Jul 17 18:36:00 GMT 2018


2018-07-17 19:34 GMT+02:00 Thomas Koenig <tkoenig@netcologne.de>:
> Am 17.07.2018 um 19:19 schrieb Janus Weil:
>> However, the test case above seems to indicate that the
>> function-elimination optimization is not applied to impure functions
>> anyway (which is good IMHO).
>
> If you specify -faggressive-function-elimination, it is also
> done for impure (and non implicitly-pure) functions.

Ah, ok.


> Problem is that, in all probability, nobody uses this option at the
> moment.

That's probably true, but it should get a little better once we move
it into -Wextra.


>> It that is true, then my modifications
>> practically disable the old -Wfunction-elimination warnings completely
>> :/
>
> I do not think it would be a problem not to warn for removing
> calls to pure or implicitly pure fuctions. The test cases can
> easily be modified not to emit this warning, as you did.
>
> As the author of the original test cases, I may be able to
> say so with a certain amount of credibility.

Good, so let's do this. Attached is another update of my patch, which
incorporates all of Fritz' comments and should regtest cleanly now.

In function_optimize_5.f90 I have removed the warnings for pure
functions and instead added -faggressive-function-elimination and the
corresponding warnings for impure functions, which were apparently not
covered by the testsuite before.

I do hope that things have converged by now and that this will be the
last incarnation of the patch. If there is no more feedback in the
next 24 hours, I'll commit this tomorrow.

Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr85599_v7.diff
Type: text/x-patch
Size: 10027 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180717/c09de149/attachment.bin>


More information about the Fortran mailing list