This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, V2, d] Fix IdentityExp comparison for complex floats
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: Johannes Pfau <johannespfau at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Dec 2018 23:05:23 +0100
- Subject: Re: [PATCH, V2, d] Fix IdentityExp comparison for complex floats
- References: <CABOHX+eBeiTYU2+xgwv2ju38S92dprV3gM_74Fu+6cSyQOphJg@mail.gmail.com> <20181128213200.20385-1-johannespfau@gmail.com> <CABOHX+cn3Ke2KkPE_8PPXZeaGRT3ozYoPzMeJr3M17ybWYdzCg@mail.gmail.com>
On Wed, 28 Nov 2018 at 23:46, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> On Wed, 28 Nov 2018 at 22:32, Johannes Pfau <johannespfau@gmail.com> wrote:
> >
> > Next version, addresses the review comments.
> >
> > Tested at https://github.com/D-Programming-GDC/GDC/pull/768
> > ---
> > gcc/d/ChangeLog:
> >
> > 2018-11-28 Johannes Pfau <johannespfau@gmail.com>
> >
> > * expr.cc (ExprVisitor::visit(IdentityExp)): Add support for complex types.
> > (build_float_identity): New function.
> >
> > gcc/testsuite/ChangeLog:
> >
> > 2018-11-28 Johannes Pfau <johannespfau@gmail.com>
> >
> > * gdc.dg/runnable.d: Test IdentityExp for complex types.
> >
> >
> > gcc/d/expr.cc | 40 ++++++++++++++++++++++++---------
> > gcc/testsuite/gdc.dg/runnable.d | 22 ++++++++++++++++++
> > 2 files changed, 51 insertions(+), 11 deletions(-)
> >
>
> As I've said before, looks reasonable to me. Thanks.
>
I noticed that this hasn't been pushed in yet, I was about to go ahead
and commit it, however... there's another case to consider, structs
with creal fields.
This test - modified from your patch - is another that should pass but
currently doesn't.
---
struct CReal
{
creal value;
}
CReal s1 = CReal(+0.0 + 0.0i);
CReal s2 = CReal(+0.0 - 0.0i);
CReal s3 = CReal(-0.0 + 0.0i);
CReal s4 = CReal(+0.0 + 0.0i);
assert(s1 !is s2);
assert(s1 !is s3);
assert(s2 !is s3);
assert(s1 is s4);
assert(!(s1 is s2));
assert(!(s1 is s3));
assert(!(s2 is s3));
assert(!(s1 !is s4));
---
I'll send a supplementary patch, and commit both together.
--
Iain