[Bug c/68121] __builtin_constant_p should not warn about integer overflow

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 28 21:54:00 GMT 2017


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-28
                 CC|                            |egallager at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Confirmed, full warning is:

$ /usr/local/bin/gcc -c -S 68121.c
68121.c:4:33: warning: integer overflow in expression of type ‘int’ results in
‘-294967296’ [-Woverflow]
     a = __builtin_constant_p (x + y) ? x : -1,
                                 ^
$

(Martin Sebor recently added the part where it calculates the result; cc-ing
him)


More information about the Gcc-bugs mailing list