public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof()
@ 2007-07-16 19:03 Steve at Zook dot com
2007-07-16 19:06 ` [Bug c++/32782] " Steve at Zook dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Steve at Zook dot com @ 2007-07-16 19:03 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/32782] inconsistant overflow in implicit conversion warning with -sizeof()
2007-07-16 19:03 [Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof() Steve at Zook dot com
@ 2007-07-16 19:06 ` Steve at Zook dot com
2007-07-16 19:30 ` [Bug c++/32782] inconsistent " pinskia at gcc dot gnu dot org
2008-03-30 22:37 ` schwab at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: Steve at Zook dot com @ 2007-07-16 19:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from Steve at Zook dot com 2007-07-16 19:05 -------
Created an attachment (id=13926)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13926&action=view)
Test code fragment compiled m68k-elf-g++ -c testpp.cpp
Lines end in \r\n.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32782
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/32782] inconsistent overflow in implicit conversion warning with -sizeof()
2007-07-16 19:03 [Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof() Steve at Zook dot com
2007-07-16 19:06 ` [Bug c++/32782] " Steve at Zook dot com
@ 2007-07-16 19:30 ` pinskia at gcc dot gnu dot org
2008-03-30 22:37 ` schwab at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-16 19:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-07-16 19:30 -------
The type of sizeof is unsigned. So you really have (short)(unsigned)-4 .
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32782
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/32782] inconsistent overflow in implicit conversion warning with -sizeof()
2007-07-16 19:03 [Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof() Steve at Zook dot com
2007-07-16 19:06 ` [Bug c++/32782] " Steve at Zook dot com
2007-07-16 19:30 ` [Bug c++/32782] inconsistent " pinskia at gcc dot gnu dot org
@ 2008-03-30 22:37 ` schwab at suse dot de
2 siblings, 0 replies; 4+ messages in thread
From: schwab at suse dot de @ 2008-03-30 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from schwab at suse dot de 2008-03-30 22:36 -------
Not a bug.
--
schwab at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
GCC host triplet|i386-pc-cygwin |
GCC target triplet|m68k-elf-unknown |
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32782
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-30 22:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 19:03 [Bug c++/32782] New: inconsistant overflow in implicit conversion warning with -sizeof() Steve at Zook dot com
2007-07-16 19:06 ` [Bug c++/32782] " Steve at Zook dot com
2007-07-16 19:30 ` [Bug c++/32782] inconsistent " pinskia at gcc dot gnu dot org
2008-03-30 22:37 ` schwab at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).