[Bug tree-optimization/96369] [8/9/10/11 Regression] Wrong evaluation order of || operator

2020-07-31 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96369

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:10231958fcfb13bc4847729eba21470c101b4a88

commit r11-2450-g10231958fcfb13bc4847729eba21470c101b4a88
Author: Richard Biener 
Date:   Fri Jul 31 08:41:56 2020 +0200

middle-end/96369 - fix missed short-circuiting during range folding

This makes the special case of constant evaluated LHS for a
short-circuiting or/and explicit rather than doing range
merging and eventually exposing a side-effect that shouldn't be
evaluated.

2020-07-31  Richard Biener  

PR middle-end/96369
* fold-const.c (fold_range_test): Special-case constant
LHS for short-circuiting operations.

* c-c++-common/pr96369.c: New testcase.

[Bug tree-optimization/96369] [8/9/10/11 Regression] Wrong evaluation order of || operator

2020-07-31 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96369

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #3 from Richard Biener  ---
I have a patch.

[Bug tree-optimization/96369] [8/9/10/11 Regression] Wrong evaluation order of || operator

2020-07-30 Thread jsm28 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96369

Joseph S. Myers  changed:

   What|Removed |Added

  Component|c   |tree-optimization
Summary|Wrong evaluation order of   |[8/9/10/11 Regression]
   ||| operator |Wrong evaluation order of
   |||| operator

--- Comment #2 from Joseph S. Myers  ---
Actually it appears the wrong code is being introduced somewhere in
fold_range_test (I didn't trace it further than that); the only front-end
involvement is that the front end does folding as part of conversions at
various points.

Testing with old compilers suggests this appeared between 4.8.1 and 4.8.3
(quite possibly through some backported change perturbing the exact sequence of
calls to folding functions rather than the actual underlying cause being
introduced in whatever backport).