public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "photon at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/40752] -Wconversion: do not warn for operands not larger than target type
Date: Wed, 15 Jul 2009 18:24:00 -0000 [thread overview]
Message-ID: <20090715182411.17110.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40752-15110@http.gcc.gnu.org/bugzilla/>
------- Comment #14 from photon at seznam dot cz 2009-07-15 18:24 -------
(In reply to comment #13)
> Or rather from SCHAR_MAX + 1 to SCHAR_MIN :). Since it is 0x7F + 1 ==
> (int)0x80. So we have a negative value now from a positive value.
>
This occurs regardless of the implicit conversion. The implicit conversion
cannot alter the result. Therefore, the warning is false in this case too.
{
char c = 0x7f;
++c;
// c is 0x80 here
c = 0x7f;
c = (int)c + 1;
// c is 0x80 here
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752
next prev parent reply other threads:[~2009-07-15 18:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 19:17 [Bug c++/40752] New: -Wconversion generates false warnings photon at seznam dot cz
2009-07-14 19:21 ` [Bug c++/40752] " pinskia at gcc dot gnu dot org
2009-07-14 20:56 ` manu at gcc dot gnu dot org
2009-07-14 20:56 ` manu at gcc dot gnu dot org
2009-07-14 22:24 ` ian at airs dot com
2009-07-14 22:30 ` [Bug c++/40752] -Wconversion: do not warn for operands not larger than target type manu at gcc dot gnu dot org
2009-07-15 7:50 ` photon at seznam dot cz
2009-07-15 7:55 ` photon at seznam dot cz
2009-07-15 8:14 ` pinskia at gcc dot gnu dot org
2009-07-15 14:00 ` ian at airs dot com
2009-07-15 14:15 ` joseph at codesourcery dot com
2009-07-15 16:56 ` photon at seznam dot cz
2009-07-15 16:58 ` pinskia at gcc dot gnu dot org
2009-07-15 17:00 ` pinskia at gcc dot gnu dot org
2009-07-15 18:24 ` photon at seznam dot cz [this message]
2009-07-16 7:07 ` [Bug c++/40752] -Wconversion generates false warnings " photon at seznam dot cz
2009-07-23 15:35 ` manu at gcc dot gnu dot org
2009-09-05 14:05 ` manu at gcc dot gnu dot org
2010-06-11 20:22 ` manu at gcc dot gnu dot org
2010-06-12 16:46 ` photon at seznam dot cz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090715182411.17110.qmail@sourceware.org \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).