This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/56917] -ftrapv detects a overflow wrongly.


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]