[Swift-devel] Re: Important: Please confirm evidence on twiceEach() bug

Michael Wilde wilde at mcs.anl.gov
Sat Apr 2 14:07:04 CDT 2011


Moving an off-list thread to the list:

A few comments below just to make sure we're all in sync...

> I was just trying to figure out what the problem was and whether the
> binary packages were affected.

My tests show that the bug occurs in the 0.92 binary and *not* in the 0.91 binary.
Please replicate these tests yourself to verify.  My test was:

com$ cat zz3.swift
int arr[];

arr[0]=1;
arr[1]=2;

foreach a in arr {
  trace("for", a);
}

com$ PATH=~/swift/rev/swift-0.91/bin:$PATH
com$ which swift
~/swift/rev/swift-0.91/bin/swift
com$ swift zz3.swift
Swift svn swift-r3826 cog-r2988

RunID: 20110402-1401-68rni1b1
Progress:
SwiftScript trace: for, 1
SwiftScript trace: for, 2
Final status:
com$ PATH=~/swift/rev/swift-0.92/bin:$PATH
com$ which swift
~/swift/rev/swift-0.92/bin/swift
com$ swift zz3.swift
Swift svn swift-r4157 cog-r3056

RunID: 20110402-1402-zqhod0ha
Progress:
SwiftScript trace: for, 2
SwiftScript trace: for, 1
SwiftScript trace: for, 1
SwiftScript trace: for, 2
Final status:
com$ 

> In that process, I had a suspicion that it was the merge because I
> thought 0.92 was tested before the release and the bug should have
> shown
> up.

The bug has *some* subtlety in that I did massive runs for modftdock on 0.92 and they never encountered this bug. 
But I verified that in at least two cases the bug does *not* occur:

foreach a,i in [0:9]
vec=readData(); foreach a,i in vec

I had two nested loops: the outer was driven by a readData array; the inner by a constant array.

I think its either the case that we have no test case for this problem, or that some tests are silently failing in our testing.

> It seemed reasonable to suspect that the merge introduced it, but
> I
> didn't test that to confirm it. I will now.

This is what I am questioning: it seems clear that this but *could not possibly* have come form Justin's recent (wrong-direction) merge in prep for 0.93.

> However, I do think the merge was done the other way around, and I
> revert it to keep in line with what we agreed was the "proper" way of
> handling releases.

Yes, I agree totally here: Justin's merge was done in the wrong direction - a well-intentioned mis-interpretetion of the Subversion book Merge chapter. I knew that Justin was going to do this, but I was not astute enough in merge and release methodology to have caught the problem. My fault as much as Justin's. But its clear to me that:

- the twiceEach bug was introduced long before this merge

- its good that we have the 0.92 branch now restored to its proper state

- we should do something like an 0.91.2 (or .1) release containing the twiceEach fix

- we should document our release methods and start (resume?) using tags as well

- we need to add a test case to the test suite for this bug, and keep growing the test suite with both functional and regression tests.

> Apart from that I will figure out what exactly the bug was due to and
> try to fix it.

Great - thanks!

- Mike



More information about the Swift-devel mailing list