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

Thomas Koenig tkoenig@netcologne.de
Sat Jun 16 21:22:00 GMT 2018


Hi Janus,

> I happen to hold the opinion that optimizing out a call to a pure 
> function may be reasonable if it does not influence the result of an 
> expression, but optimizing out an effectively impure function (i.e. one 
> with side effects) is not a good idea at any time, since such an 
> 'optimization' can drastically change the program flow and all numerical 
> results of a piece of code.

Well, I am of a different opinion, and so is the Fortran standard.

I think the compiler should strive to, in that order,

- conform to the language standard
- generate fast programs
- warn about features which may trip the user

In my patch, I have tried to do all three things at the same time, and
after this discussion, I still think that this is the right path
to follow.

So, here is an update on the patch, which also covers ALLOCATED.

Regression-tested. OK?

	Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logical_evaluation_1.f90
Type: text/x-fortran
Size: 1344 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180616/f05b0353/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p5.diff
Type: text/x-patch
Size: 4128 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180616/f05b0353/attachment-0001.bin>


More information about the Fortran mailing list