This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/85599] Function need not be evaluated in logical expression


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=57160

--- Comment #14 from janus at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #10)
> Am I mistaken to read this as being handled by the middle-end?

The short-circuiting is finally handled by the middle end, since the front end
translates .and. into &&. See also comment 6.

Apparently the standard does neither require nor forbid the short-circuiting
(see c.l.f. discussion), but I would argue that it would be a more reasonable
for gfortran to avoid the short-circuiting (by translating to &), at least if
it is not clear whether the function has side effects.


> If yes, the
> situation is discussed in pr57160 comment 1.

Right, this PR is very much related.


> Does it means that 'check' has to be evaluated in
> 
> if (flag) flag = check ()
> 
> even if flag==.false. ?

No, I'm pretty sure that is not the case.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]