[Bug c++/92660] overflow warning message enhancement

2020-01-30 Thread jg at jguk dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92660

--- Comment #1 from Jonny Grant  ---


Improved suggestion with the sign indicated:
const int n = 411;


:1:15: warning: overflow in conversion from 'long int' (signed 64bit)
to 'int' (signed 32bit) changes value from '411' to '-1838561849'
[-Woverflow]
1 | const int n = 411;
  |   ^~~




Another example:
const unsigned int n = 411;

Improved suggestion with the sign indicated:

:1:24: warning: unsigned conversion from 'long int' (signed 64bit) to
'unsigned int' (unsigned 32bit) changes value from '411' to
'2456405447' [-Woverflow]

1 | const unsigned int n = 411;

  |^~~

[Bug c++/92660] overflow warning message enhancement

2020-01-30 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92660

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-01-30
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/92660] overflow warning message enhancement

2019-11-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92660

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
   Severity|normal  |enhancement