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
What steps will reproduce the problem?
Two test cases which evaluate differently can be found here
<http://gist.github.com/410574>;. I
use 8g version 5440.
What is the expected output? What do you see instead?
The compiler to generate code that either first evaluates all expressions in the chained
arguments, or code that evaluates the chain from left-to-right. Either way, not to do it
differently.
What is your $GOOS? $GOARCH?
darwin; 386
Which revision are you using? (hg identify)
17ded5ad443b tip
Please provide any additional information below.
Relevant assembly is also attached. Line 27 clearly starts with invoking s.Len(), while
line 33
begins with s.Clear().
Btw, I might imagine that this is just 'the way things work' with the len(...)
expression probably
just being a pointer to the slice's length field or something, but still, from an
implementing view it
took me half the night to figure out what the hell was going on.
The text was updated successfully, but these errors were encountered:
Thanks for the test case.
The spec is quite clear that in
s.Clear().Push(byte(s.Len()))
the s.Clear() must run before s.Len().
The same is true of
s.Clear().Push(byte(len(s.a)))
This is a bug in 8g and probably 5g and 6g too.
Alright, nice to see it is just an implementation-thing ;).
Although I initially expected the bug to be dependent on one of the quirks of my
original implementation, this
appeared to be an incorrect assumption. I have therefore cleaned up the test case (at
the same gist), and
confirmed that it indeed also goes wrong when using darwin/6g.
by emiel.mols:
The text was updated successfully, but these errors were encountered: