This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/45034] [4.3/4.4/4.5/4.6 Regression] "safe" conversion from unsigned to signed char gives broken code
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jul 2010 22:42:51 -0000
- Subject: [Bug tree-optimization/45034] [4.3/4.4/4.5/4.6 Regression] "safe" conversion from unsigned to signed char gives broken code
- References: <bug-45034-7665@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from joseph at codesourcery dot com 2010-07-27 22:42 -------
Subject: Re: [4.3/4.4/4.5/4.6 Regression] "safe"
conversion from unsigned to signed char gives broken code
On Tue, 27 Jul 2010, mikpe at it dot uu dot se wrote:
> Personally I think GCC should treat source-level casts as wrapping, regardless
> of -fstrict-overflow and -fno-wrapv. Perhaps it intends to, and we're just
> seeing the effects of bugs.
This implementation-defined behavior is already documented in
implement-c.texi:
@item
@cite{The result of, or the signal raised by, converting an integer to a
signed integer type when the value cannot be represented in an object of
that type (C90 6.2.1.2, C99 6.3.1.3).}
For conversion to a type of width @math{N}, the value is reduced
modulo @math{2^N} to be within range of the type; no signal is raised.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45034