[Issue 2224] Bad codegen for array element assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 12 00:20:05 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2224


Matti Niemenmaa <matti.niemenmaa+dbugzilla at iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |matti.niemenmaa+dbugzilla at i
                   |                            |ki.fi
         Resolution|                            |INVALID


--- Comment #3 from Matti Niemenmaa <matti.niemenmaa+dbugzilla at iki.fi> 2009-09-12 00:20:04 PDT ---
This is not a bug.

There's no sequence point in "mem.data[d+i]=r(a+i);", so the order of
evaluation of mem.data[d+i] and r(a+i) is unspecified. r calls both mem.push
and mem.pushn, both of which may lead to reallocations of mem.data, possibly
moving the array to a completely different location. Thus the behaviour of the
code depends on whether r(a+i) or mem.data is evaluated first.

The "bug" is no doubt due to the mem.data getting evaluated first, since doing
the temporary assignment forces it to be the other way around.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list