This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]