Re: [match.pd PATCH] PR tree-optimization/126467: 0.0-x -> -x vs. signed zeros.

Andrea Pinski <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcAnVjNH8XMp3uy6OvuhrAnfW4uFcHizemUzxQt+NrSMsw@mail.gmail.com>
On Fri, Aug 7, 2026 at 2:57 AM Roger Sayle <[email protected]> wrote:
>
>
> > From: Alexander Monakov <[email protected]>
> > Sent: 07 August 2026 08:45
> > On Wed, 5 Aug 2026, Roger Sayle wrote:
> >
> > > gcc/testsuite/ChangeLog
> > >         PR tree-optimization/126467
> > >         * gcc.dg/pr126467-1.c: New test case.
> > >         * gcc.dg/pr126467-2.c: Likewise.
> > >         * gcc.dg/pr96392.c: Fix incorrect test case.
> >
> > Sorry, what is incorrect in this testcase? x is an int there:
> >
> > -double negate(int x)
> > -{
> > -  return 0.0 - x;
> > -}
>
> Hi Alexander,
> Yes, x is an int, so when promoted to double (because of the 0.0)
> it becomes +0.0, and as described +0.0 - +0.0 is not the same
> as -(double)0.  Interestingly, I ran "git blame" to figure out which
> misguided fool wrote this test case... It turns out it was me.
> Live and learn.
>
> Short answer, this test case now fails with this (any) fix
> for PR tree-optimization/126467.

That is until finalized ranger support is hooked up to say int->fp
conversion does not produce -0.0.
This is being worked on.
Can you add a separate testcase and xfail currently?

Thanks,
Andrea

>
> Thanks for your help/feedback.
> Roger
> --
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.