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

--- Comment #8 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Alejandro Colomar from comment #7)
> (In reply to Joseph S. Myers from comment #6)
> > That's the distinction between pedwarns for overflow, in contexts where a
> > constant expression is required, and warnings, in contexts where one isn't
> > but an expression with constant operands would overflow and produce UB at
> > runtime if evaluated.
> 
> Should the bug be reopened?  I don't think it's invalid; or at least, the
> reasons given for considering it invalid are not technically correct.

No because there is no way to figure at compile time (in the front-end) that
twogig+twogig would overflow. It is only happens during the middle-end. Which
we are not going to add a warning for; we just removed the warning overflow
related stuff.

Also:
int x = TWOGIG+TWOGIG;

is the global scope so `TWOGIG+TWOGIG` needs to be an constant expression. So
the overflow happens during constant expression evulation.  It looks like you
were confusing `twogig+twogig` usage vs `TWOGIG+TWOGIG` usage.

Reply via email to