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

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Tue Sep 25 13:48:27 PDT 2012


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

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject.org> 2012-09-25 20:48:27 UTC ---
You may think so, but this is actually not a bug, just a little known example
of an x86-specific quirk.

In D functions (thus, extern D) - everything should be evaluated left to right
(LTR).  And I am pretty confident for most cases, GDC gets this correct in the
codegen despite pulling an arm or two in the process to get it done.

For extern C functions you are left up to the order of which the underlying
architecture pushes arguments on the stack.  As it just so happens, x86/x86_64
is right to left (RTL), aka PUSH_ARGS_REVERSED.

So expecting BCA makes sense as:
A()[] = B()[] + C()[];

Gets turned into:
_arraySliceSliceAddSliceAssign_f(A[], C[], B[]);

Hence why it asserts that the result is "BCA".


However, ARM pushes arguments on the stack LTR, so we should instead expect the
result of the array operation to be "ACB"

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


More information about the D.gnu mailing list