This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, V2, d] Fix IdentityExp comparison for complex floats


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]