Expression evaluation order

David Nadlinger code at klickverbot.at
Sat Jun 15 10:16:22 PDT 2013


On Friday, 14 June 2013 at 09:59:07 UTC, Iain Buclaw wrote:
> Interesting, that certainly doesn't flag up as a regression in 
> the
> 2.063 merge in GDC... :o)
>
> However yes, the behaviour relies on the order the sucky X86 ABI
> pushes arguments onto the stack (which for this array op is 
> from right
> to left).  Whereas on *all* other architectures it will execute 
> the
> parameters in left to right order, which would be a, c, b in 
> this
> case.

In LDC, the actual evaluation order is completely separate from 
the target ABI (you simply pass the SSA vales to a function call 
in LLVM, and you can decide the order in which to create them 
yourself).

Turns out that for array operations, we actually need to reverse 
the order compared to our normal one (left to right), as their 
signatures have specifically been chosen for the evaluation order 
in DMD that is intertwined with the backend ABI/function call 
implementation details.

David


More information about the Digitalmars-d mailing list