--- Comment #11 from mathieu at malaterre dot com 2006-08-07 20:25 ---
Tested today (Aug 7, 2006) with:
$ /usr/lib/gcc-snapshot/bin/g++ --version
/tmp
g++ (GCC) 4.2.0 20060721 (experimental)
Copy
--- Additional Comments From falk at debian dot org 2005-07-15 19:53
---
(In reply to comment #9)
> I cannot seems to find a way to generate traps on overflow.
-ftrapv does not trigger on overflowing calculations that are compile-time
constant. I am unsure whether this is a bug or a fe
--- Additional Comments From mathieu at malaterre dot com 2005-07-06 03:00
---
Using gcc --version:
g++ (GCC) 4.1.0 20050607 (experimental)
I can still reproduce the same unsafe operation:
#include
int main()
{
unsigned int l = (unsigned int)-1;
const int a = l/2;
const int b =
--- Additional Comments From mathieu at malaterre dot com 2005-07-06 02:59
---
Using gcc --version:
g++ (GCC) 4.1.0 20050607 (experimental)
I can still reproduce the same unsafe operation:
#include
int main()
{
unsigned int l = (unsigned int)-1;
const int a = l/2;
const int b =
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-06
02:33 ---
(In reply to comment #6)
> It looks like -ftrapv only works on signed overflow.
Yes because signed overflow is undefined. unsigned overflow wraps by both the
C and C++ standards.
--
What|R
--- Additional Comments From mathieu at malaterre dot com 2005-07-06 02:32
---
Using gcc --version:
g++ (GCC) 4.1.0 20050607 (experimental)
I still cannot get anything using the -ftrapv:
Ex is:
#include
int main()
{
const unsigned int a = 11;
const unsigned int b = 10;
const d
--- Additional Comments From giovannibajo at libero dot it 2004-10-28 03:44
---
So, is this bug still valid, or does -ftrapv do what you want?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17645