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

Thomas Koenig tkoenig@netcologne.de
Tue Jul 17 17:34:00 GMT 2018


Am 17.07.2018 um 19:19 schrieb Janus Weil:
> 2018-07-17 17:18 GMT+02:00 Fritz Reese <fritzoreese@gmail.com>:
>>> 2018-07-17 9:52 GMT+02:00 Janus Weil <janus@gcc.gnu.org>:
>>>> In other words: Does it make sense to tone down
>>>> -Wfunction-elimination, by only warning about impure functions?
>>>
>>> Here is an update of the patch which does that. Regtesting now ...
>>
>> Would not this break the testcase function_optimize_5.f90 :
> 
> My regtest says so as well ;)
> 
> 
>> The docs for -Wfunction-elimination would read:
>>
>>> Warn if any calls to functions are eliminated by the optimizations
>>> enabled by the @option{-ffrontend-optimize} option.
>>> This option is implied by @option{-Wextra}.
>>
>> However, with your patch, it should probably read something like "warn
>> if any calls to impure functions are eliminated..." Possibly with an
>> explicit remark indicating that pure functions are not warned.
> 
> Yes.
> 
> 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.

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

> 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.

The actual elimination is checked for by counting the
function names in the *.original dump file, which is done.



More information about the Fortran mailing list