This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36300] Incorrect type used for inlined expression
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 May 2008 12:53:15 -0000
- Subject: [Bug middle-end/36300] Incorrect type used for inlined expression
- References: <bug-36300-16214@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from rguenther at suse dot de 2008-05-27 12:53 -------
Subject: Re: Incorrect type used for inlined expression
On Tue, 27 May 2008, acarmeli at mathworks dot com wrote:
> ------- Comment #8 from acarmeli at mathworks dot com 2008-05-27 12:50 -------
> Richard,
>
> I truly appreciate your effort on this bug.
>
> Can you please elaborate on your plan? Will this be fixed for -fwrapv only, or
> also for -fwrapv-free compilations?
>
> I understand that downcasting an out-of-range value to a signed integer is not
> defined in the standard. However, many compilers offer an "expected" modulo-2^n
> behavior. This behavior helps avoid writing extra cumbersome "safe downcast"
> code. Having GCC offer it for non -fwrapv compilations is an important
> interoperability and readability feature.
>
> Thank you for looking into it.
This is only fixed for -fwrapv (this is the "expected" modulo-2^n behavior
switch). It was never broken for the defined variant with the casts
to unsigned before the multiplication.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36300