https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92660

            Bug ID: 92660
           Summary: overflow warning message enhancement
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Could GCC, for both C and C++ output the bitsize on the overflow warning ?

const int n = 41111111111;

#1 with x86-64 gcc (trunk)
<source>:1:15: warning: overflow in conversion from 'long int' to 'int' changes
value from '41111111111' to '-1838561849' [-Woverflow]
    1 | const int n = 41111111111;
      |               ^~~~~~~~~~~





Suggestion:

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

Reply via email to