This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is -3.I (as opposed to 0-3.I) supposed evaluate to?
On Tue, Jun 9, 2009 at 11:26 AM, Kaveh R. Ghazi<ghazi@caip.rutgers.edu> wrote:
> From: "Joseph S. Myers" <joseph@codesourcery.com>
>
>> On Mon, 8 Jun 2009, Kaveh R. Ghazi wrote:
>>
>>> Perhaps the only safe way to create the value, even in the presence of
>>> rounding mode changes, is to use conj(3.I) ?
>>
>> Setting the __real__ and __imag__ parts of a temporary variable should
>> always be reliable for making a complex number out of arbitrary real and
>> imaginary parts.
>
> Well yes, but I meant for compile-time expressions that are exposed to fold
> even at -O0. ?(Recall that I'm writing testcases for the MPC stuff.) ?I'm
> not 100% confident that the temporary variable will always fold and it's too
> verbose when repeatedly used in a testcase. ?With conj, the builtin will
> always fold 3.I and won't do anything unexpected with rounding modes.
It should always be folded via CCP / value-numbering. If not that is a bug
that needs to be fixed.
Richard.
> I was just wondering why -3.I was evaluating differently than 0-3.I and
> whether it was a bug. ?Your explanation was very useful.
> ? ? ? Thanks,
> ? ? ? --Kaveh
>
>