[Bug c/17645] Add a warning for potentially unsafe unsigned operations

2006-08-07 Thread mathieu at malaterre dot com
--- 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)

[Bug c/17645] Add a warning for potentially unsafe unsigned operations

2005-07-15 Thread falk at debian dot org
--- 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

[Bug c++/17645] Add a warning for potentially unsafe unsigned operations

2005-07-05 Thread mathieu at malaterre dot com
--- 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 iostream int main() { const unsigned int a = 11; const unsigned int b = 10;

[Bug c/17645] Add a warning for potentially unsafe unsigned operations

2005-07-05 Thread pinskia at gcc dot gnu dot org
--- 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

[Bug c++/17645] Add a warning for potentially unsafe unsigned operations

2005-07-05 Thread mathieu at malaterre dot com
--- 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 iostream int main() { unsigned int l = (unsigned int)-1; const int a = l/2;

[Bug c/17645] Add a warning for potentially unsafe unsigned operations

2005-07-05 Thread mathieu at malaterre dot com
--- 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 iostream int main() { unsigned int l = (unsigned int)-1; const int a = l/2;