This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/68971] -Woverflow false alarm in code unreachable after __builtin_mul_overflow
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Dec 2015 01:28:00 +0000
- Subject: [Bug c/68971] -Woverflow false alarm in code unreachable after __builtin_mul_overflow
- Auto-submitted: auto-generated
- References: <bug-68971-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, the example in footnote is valid because the left operand of the OR
expression is a constant expression with a non-zero value and so the right
operand is not evaluated (even at translation time).
__builtin_mul_overflow, OTOH, is not a constant expression, and so the
multiplication expression may be evaluated (and is allowed to be evaluated at
compile time) and the warning is, IMO, justified.