[patch, fortran] Handling of .and. and .or. expressions

N.M. Maclaren nmm1@cam.ac.uk
Thu Jun 28 14:28:00 GMT 2018


On Jun 28 2018, Janus Weil wrote:
>>
>> It's moot whether such a warning should rely on implicit pure detection,
>> because the gotcha with doing so is the programmer modifies the function,
>> adds a side-effect, does NOT recompile the calling code, and can't work
>> out why nothing has changed!  Been there - done that :-)  Response to
>> self on locating it: you IDIOT, Nick!
>
>I hope that nowadays the necessity for such self-insults is
>significantly decreased as more people use a proper build system
>(which takes care of dependencies and rebuilds everything as needed).
>cmake does a pretty good job with this by now, in particular in
>connection with gfortran. So I wouldn't put too much weight into this
>argument ...

Oh, yes, but the last time I fell into it is one that will be with us for
always.  I had 'de-PUREd' some procedures in order to do some tracing,
forgot that a particular subroutine was called from a function as well as
other subroutines, and that function was called in an expression of the
sort we are discussing.  In particular, when I compiled the procedure
that contained the expression, the subroutine at the very bottom WAS still
pure!  It was only when I added the tracing that it wasn't.

That's why I prefer diagnostics based on the stated interface, and not on
what some other code currently does.  Relying on the latter rather than a
clear specification is one of the besetting sins of modern software, and
is a major obstacle to improvements.

Regards,
Nick Maclaren.



More information about the Gcc-patches mailing list