This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/56917] -ftrapv detects a overflow wrongly.
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Jun 2015 13:04:15 +0000
- Subject: [Bug middle-end/56917] -ftrapv detects a overflow wrongly.
- Auto-submitted: auto-generated
- References: <bug-56917-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56917
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
This also fixed a rejects-valid
int lValue;
int main()
{
switch (lValue)
{
case -(int)((2U << (8 * sizeof(int) - 2)) - 1) - 1:;
}
}
> g++-4.8 cMinLongValue.ii
cMinLongValue.ii: In function âint main()â:
cMinLongValue.ii:6:54: error: overflow in constant expression [-fpermissive]
case -(int)((2U << (8 * sizeof(int) - 2)) - 1) - 1:;
^
cMinLongValue.ii:6:54: error: overflow in constant expression [-fpermissive]
I am going to backport and add this testcase.