[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2021-07-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Keywords||accepts-invalid
   Target Milestone|--- |6.0
 Status|UNCONFIRMED |RESOLVED

--- Comment #6 from Andrew Pinski  ---
Fixed in GCC 6 with r6-4886 (note this is expected because we delay
simplifications until after semantics anlysis now).

[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2015-10-21 Thread yaghmour.shafik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986

--- Comment #5 from Shafik Yaghmour  ---
It looks like this case from this Stackoverflow question
http://stackoverflow.com/q/32920229/1708801 is possibly related:

int main(int argc, char**)
{
constexpr int a = argc * 0;
}

gcc treats `argc * 0` as a constant expression a comment indicates this is due
to constant folding and it seems possible that gcc is constant folding `i ||
true` as well.


[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2015-07-29 Thread yaghmour.shafik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986

Shafik Yaghmour yaghmour.shafik at gmail dot com changed:

   What|Removed |Added

 CC||yaghmour.shafik at gmail dot 
com

--- Comment #4 from Shafik Yaghmour yaghmour.shafik at gmail dot com ---
This issue showed up recently in this Stackoverflow question:
http://stackoverflow.com/q/31526278/1708801

As far as I can tell there should at least be a diagnostic when using -pedantic


[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2013-01-15 Thread potswa at mac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986



--- Comment #3 from David Krauss potswa at mac dot com 2013-01-15 08:02:55 
UTC ---

Likewise this is allowed:



switch( 0 )

case i-i: ;



I think this is a purposeful language extension, which could use a switch to

disable. It would be nice if static_assert were always strict.


[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2013-01-14 Thread potswa at mac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986



--- Comment #1 from David Krauss potswa at mac dot com 2013-01-15 04:47:53 
UTC ---

Passing `-O2` additionally causes it to skip a condition like `(i == 0 || i !=

0)`, so it looks like a general issue with expression simplification bypassing

ODR-use.


[Bug c++/55986] RHS of logical operators may render LHS unevaluated in constant-expression

2013-01-14 Thread potswa at mac dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55986



--- Comment #2 from David Krauss potswa at mac dot com 2013-01-15 04:48:47 
UTC ---

Passing `-O2` additionally causes it to skip a condition like `(i == 0 || i !=

0)`, so it looks like a general issue with expression simplification bypassing

use.