Bug 27261 - -ftrapv doesn't work.
-ftrapv doesn't work.
Status: RESOLVED DUPLICATE of bug 19020
Product: gcc
Classification: Unclassified
Component: other
4.1.1
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-22 14:05 UTC by Pawel Sikora
Modified: 2006-04-22 15:41 UTC (History)
3 users (show)

See Also:
Host: x86-64-linux
Target: x86-64-linux
Build: x86-64-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2006-04-22 14:05:36 UTC
#include <cstdio>
int main()
{
        int x = 0x80000000;
        std::printf( "%08x\n", x );
        x *= 2;
        std::printf( "%08x\n", x );
        // still here?
        std::puts( "-ftrapv doesn't work :(" );
        return 0;
}

$ g++ signed_overflow_3.cpp; ./a.out; echo $?
80000000
00000000
-ftrapv doesn't work :(
0

gcc version 4.1.1 20060419 (prerelease)
Comment 1 Pawel Sikora 2006-04-22 14:07:13 UTC
of course command line shoud be: $ g++ signed_overflow_3.cpp -ftrapv ...
Comment 2 Andrew Pinski 2006-04-22 15:41:04 UTC

*** This bug has been marked as a duplicate of 19020 ***