You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good job in finding the problem and fixing it so fast. I've confirmed that your fix indeed solves the array construction issue, but it seems that the rabbit hole is even deeper; the same behavior is observed in hash construction as well, for both keys and values.
You unearthed a gold mine of a bug here! :) A lot of parallel value construction in many call scenarios are broken. Interesting that this kind of bug never surfaced in mri tests or rubyspec.
a = 10
b = a / (a=10)
p b # prints 1
a = "xyz"
p (a =~ (a = /[x]/)); # throws an exception
@enebo@headius fyi .. so, the real brain dead fix would be to just force all build values to go through 'copyAndReturnValue' and let OptimizeTempVarsPass, LocalOptPass, etc. propagate useless copies (which there will be lots of now). Otherwise, we'll have to look at all parallel value construction in calls, attr assign, etc. and fix up where required (even so, there will be lots of copies).
For the array and hash literal construction cases, after those passes and DCE runs, the output is:
I am resolving this. I covered the cases apparent where we have a list of arguments which must be processed. It is possible some cases were missed (regression spec should cover broad cases known), but if any new cases are found a new issue should be opened.