[Bug 8] ARM: runnable/arrayop.d fails: Wrong execution order

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Thu Feb 13 11:57:41 PST 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=8

--- Comment #14 from Iain Buclaw <ibuclaw at gdcproject.org> 2014-02-13 19:57:41 GMT ---
(In reply to comment #11)
> OK. So do you want to fix this or shall I?

I'm pretty tied up getting gdb D into shape, and working with a publishing
company in reviewing a new D2 book, and doing the 2.065 merge - which depends
on preliminary stuff such as eventual Visitor conversions almost *all* our glue
code, and re-implement dfrontend/builtins.c into the glue cause the new
revision of it in 2.065 is not GDC-friendly...


The long route in GDC would be (doing this in my head):

1. d-codegen.cc(d_build_call): Lift the LINKd restriction in which caches
arguments in a LTR fashion.

2. dfrontend/arrayops.c(AssignExp::buildArrayIdent,
BinAssignExp::buildArrayIdent, AssignExp::buildArrayLoop,
BinAssignExp::buildArrayLoop): Evaluate assign expressions left to right

3. Reverse the parameters for all arrayops in druntime.

// a[] = b[] op value:
(T[] a, T value, T[] b)  =>  (T[] b, T value, T[] a)

// a[] = b[] op c[]
(T[] a, T[] c, T[] b)  =>  (T[] b, T[] c, T[] a)

// a[] += value
(T[] a, value)  =>  (value, T[] a)

// a[] += b[]
(T[] a, T[] b)  =>  (T[] b, T[] a)

4. Test!

5. Push upstream, where someone will work out how to fix it in DMD.


Unless Mr. Andrei thinks that a[] = b[] op c[] should be evaluated in order of:
a[] -> b[] -> c[]

Instead of keeping the current behaviour:
b[] -> c[] -> a[]

In which case, just do items number #1, #4 and #5 in the list above.  With the
additional step of at stage #4 fix old tests that relied on the old behaviour
of evaluation.

Regards
Iain.

-- 
Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the D.gnu mailing list