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

Alejandro Colomar <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #5 from Alejandro Colomar <[email protected]> ---
(In reply to Drea Pinski from comment #1)
> twogig+twogig is only undefined if executed.
> While TWOGIG+TWOGIG is considered as part of a constant integer expression
> so it need to warn there.

This is not correct.  TL;DR:  Both of them only have UB if executed, and none
of them violate any constraints.  See below.

CC += Joseph

TWOGIG+TWOGIG, by being part of an argument to a function, is not a constant
expression.

According to Joseph, the response to issue 0261 is relevant here.

<https://www.open-std.org/jtc1/sc22/wg14/issues/c99/log.html#issue0261>

The response to that issue was:

  In general, the interpretation of an expression for constantness is
  context sensitive. For any expression which contains only constants:

  * If the syntax or context only permits a constant expression, the
    constraints of 6.6#3 and 6.6#4 shall apply.
  * Otherwise, if the expression meets the requirements of 6.6 (including
    any form accepted in accordance with 6.6#10), it is a constant
    expression.
  * Otherwise it is not a constant expression.

Thus, both TWOGIG+TWOGIG and twogig+twogig are regular expressions, and both
have UB.  There is no constraint violation in that program.

Reply via email to