[Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof()

Steve at Zook dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 16 19:03:00 GMT 2007


When calling a procedure with signed char or short arguments using -sizeof() as
an expression, an "<filename>:<line#>: warning: overflow in implicit constant
conversion" is output. Arguments with int or long do not. This happens even
though there is no real overflow (e.g. if -sizeof() evaluates to -4). See
attached test program (compiled using command line m68k-elf-g++ -c
testcpp.cpp). Proper code is produced. Warning can be avoided by casting
sizeof() to int (i.e. -(int)sizeof() ). Similar results are obtained when
returning a -sizeof() value in procedures with return type signed char or
short. This warning does not occur in revision 3.4.6.


-- 
           Summary: inconsistant overflow in implicit conversion warning
                    with -sizeof()
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Steve at Zook dot com
  GCC host triplet: i386-pc-cygwin
GCC target triplet: m68k-elf-unknown


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32782



More information about the Gcc-bugs mailing list