chadwhitacre / go

The Go programming language
https://golang.org
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

22326, Take Two #3

Closed chadwhitacre closed 3 years ago

chadwhitacre commented 5 years ago

Okay! Let's do this ...

Like ... doesn't the test suite exercise gccgo against the standard library? Why doesn't that fail? More research required ...

It does. I suspect there's a bug in this CL if gccgo (with the same behavior you're implementing) passes the stdlib tests fine.

https://go-review.googlesource.com/c/go/+/156328/1#message-43a5ed07c4e3c86c72ceeacce227c3ee59b9b587

chadwhitacre commented 5 years ago

Let's make sure that returning out instead of lout is the thing that hoses the stdlib.

chadwhitacre commented 5 years ago

https://gist.github.com/chadwhitacre/96d88209940bb678328e7491d759105b

$ time (./all.bash -v > out 2>&1); say 'yeah'

real    16m27.882s
user    30m47.889s
sys     8m27.166s
$
diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go
index a5737ad..2a0ff21 100644
--- a/src/cmd/compile/internal/gc/sinit.go
+++ b/src/cmd/compile/internal/gc/sinit.go
@@ -444,7 +444,7 @@ func initfix(l []*Node) []*Node {
        }
    }

-   return out
+   return lout
 }

 // compilation of top-level (static) assignments

916c2d8

chadwhitacre commented 5 years ago

It's not! There are multiple places where I didn't update &foo.Linkfoo to foo.MakeLinkfoo(). I've made another whack at those and am rerunning ...

chadwhitacre commented 5 years ago

Clean with lout in 98284ab!

$ tail -f src/out |grep FAIL
FAIL    fixedbugs/issue22326.go 1.455s
2019/01/05 15:31:39 FAILED
$ time (./all.bash -v > out 2>&1); say 'yeah'

real    30m24.490s
user    59m15.327s
sys     20m47.803s
$

https://gist.github.com/chadwhitacre/3c01d78c29ed9fa7d091e466020d0761

chadwhitacre commented 5 years ago

Now to go back to out and see if it's totally all clean! πŸ™ˆ

chadwhitacre commented 5 years ago

Dangit! πŸ˜•

$ time (./all.bash -v > out 2>&1); say 'yeah'

real    16m28.586s
user    30m54.471s
sys     8m38.126s
$

https://gist.github.com/chadwhitacre/04ecb8e40fde3449951cb971669a5309

diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go
index 2a0ff21..a5737ad 100644
--- a/src/cmd/compile/internal/gc/sinit.go
+++ b/src/cmd/compile/internal/gc/sinit.go
@@ -444,7 +444,7 @@ func initfix(l []*Node) []*Node {
        }
    }

-   return lout
+   return out
 }

 // compilation of top-level (static) assignments
chadwhitacre commented 5 years ago

πŸ€”

$ ../../../bin/go run ../../../test/fixedbugs/issue22326.go 
$ ../../../bin/go test
PASS
ok      archive/tar     0.046s
$
chadwhitacre commented 5 years ago

Sorry, there we go ...

/Users/whit537/workbench/go/src/github.com/golang/go/src/archive
total 0
drwxr-xr-x  16 whit537  wheel  512 Jan  3 16:06 tar/
drwxr-xr-x  11 whit537  wheel  352 Nov 25 08:12 zip/
$  cd zip/
$ ../../../bin/go test
--- FAIL: TestReader (0.03s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:507: error=zip: not a valid zip file, want <nil>
    --- FAIL: TestReader/Bad-CRC32-in-data-descriptor (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
    --- FAIL: TestReader/crc32-not-streamed.zip#01 (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
FAIL
exit status 1
FAIL    archive/zip     52.247s
$
chadwhitacre commented 5 years ago

Alright yeah the ZIP reader test seem to relate to variables defined at the top level, which makes me think that the MakeLink workaround is also going to need to be undone.

https://github.com/chadwhitacre/go/blob/98284ab3b6eac25692198ee257e8fa6e8f82362e/src/archive/zip/reader_test.go#L52-L482

chadwhitacre commented 5 years ago

678f9c1f890a67e688a5f3ad69b63123ac61324d πŸ‘

/Users/whit537/workbench/go/src/github.com/golang/go/src/archive/borked
total 84
-rw-r--r--   1 whit537  wheel  17838 Jan  5 16:07 reader.go
-rw-r--r--   1 whit537  wheel  31565 Jan  5 16:07 reader_test.go
-rw-r--r--   1 whit537  wheel   3754 Jan  5 16:07 register.go
-rw-r--r--   1 whit537  wheel  11513 Jan  5 16:07 struct.go
drwxr-xr-x  29 whit537  wheel    928 Jan  5 16:07 testdata/
-rw-r--r--   1 whit537  wheel  16230 Jan  5 16:07 writer.go
$ ../../../bin/go test
--- FAIL: TestReader (0.02s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:507: error=zip: not a valid zip file, want <nil>
    --- FAIL: TestReader/Bad-CRC32-in-data-descriptor (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
    --- FAIL: TestReader/crc32-not-streamed.zip#01 (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
FAIL
exit status 1
FAIL    archive/borked  0.043s
$
chadwhitacre commented 5 years ago

b96e86849b20940fe05e16123b930eae5db73387 πŸ‘

$ ../../../bin/go test
--- FAIL: TestReader (0.02s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:507: error=zip: not a valid zip file, want <nil>
    --- FAIL: TestReader/Bad-CRC32-in-data-descriptor (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
    --- FAIL: TestReader/crc32-not-streamed.zip#01 (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
FAIL
exit status 1
FAIL    archive/borked  0.038s
$
chadwhitacre commented 5 years ago

Scratch that ... 66efb757ef6e5afc62bad0b372586e552898cfdb πŸ‘

$ ../../../bin/go test
--- FAIL: TestReader (0.02s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:507: error=zip: not a valid zip file, want <nil>
    --- FAIL: TestReader/Bad-CRC32-in-data-descriptor (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
    --- FAIL: TestReader/crc32-not-streamed.zip#01 (0.00s)
        reader_test.go:600: copying contents: zip: checksum error (want <nil>)
FAIL
exit status 1
FAIL    archive/zorp    0.039s
$
chadwhitacre commented 5 years ago

bbe5417109b3ca5ad47815883453f61d310eec34 πŸ‘

$ ../../../bin/go test
--- FAIL: TestReader (0.00s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:82: error=zip: not a valid zip file, want <nil>
FAIL
exit status 1
FAIL    archive/zorp    0.014s
$
chadwhitacre commented 5 years ago

Alright, so ErrFormat is coming in as nil when it should be ... something else?

https://github.com/chadwhitacre/go/blob/bbe5417109b3ca5ad47815883453f61d310eec34/src/archive/zorp/reader_test.go#L52-L57

chadwhitacre commented 5 years ago

Getting somewhere!

https://github.com/chadwhitacre/go/blob/bbe5417109b3ca5ad47815883453f61d310eec34/src/archive/zorp/reader.go#L19-L23

chadwhitacre commented 5 years ago

90b949f796d2d76fed49dd9a2851756c57b37aef πŸ‘

$ ../../../bin/go test
--- FAIL: TestReader (0.00s)
    --- FAIL: TestReader/readme.notzip (0.00s)
        reader_test.go:75: error=zip: not a valid zip file, want <nil>
FAIL
exit status 1
FAIL    archive/zorp    0.015s
$
chadwhitacre commented 5 years ago

bf1c4e737d76ca13fe9073471c65cdfb7b18b7a8 πŸ‘

/Users/whit537/workbench/go/src/github.com/golang/go/src/archive/foo
total 8
-rw-r--r--  1 whit537  wheel  147 Jan  5 16:39 foo.go
-rw-r--r--  1 whit537  wheel  486 Jan  5 16:40 foo_test.go
$ ../../../bin/go test
--- FAIL: TestFoo (0.00s)
    --- FAIL: TestFoo/blah (0.00s)
        foo_test.go:31: error=blah blah GINGER blah blah, want <nil>
FAIL
exit status 1
FAIL    archive/foo     0.013s
$
chadwhitacre commented 5 years ago

e117192

$ ../../../bin/go test
--- FAIL: TestFoo (0.00s)
    foo_test.go:24: error=blah blah GINGER blah blah, want <nil>
FAIL
exit status 1
FAIL    archive/foo     0.014s
$
chadwhitacre commented 5 years ago

f340da91a2cd8ba840d8a6cc71dbb747ec32f35d πŸ‘

$ ../../../bin/go test
--- FAIL: TestFoo (0.00s)
    foo_test.go:14: error=blah blah GINGER blah blah, want <nil>
FAIL
exit status 1
FAIL    archive/foo     0.013s
$
chadwhitacre commented 5 years ago

e82669f688fe2d9d1feff15b69db1d0cfe0d423b

$ time (./make.bash -v > out 2>&1); say 'yeah'

real    4m5.863s
user    8m35.652s
sys     1m15.742s
$
$ ../../../bin/go test
# archive/foo [archive/foo.test]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
# archive/foo.test
lout:
out:
--- FAIL: TestFoo (0.00s)
    foo_test.go:14: error=blah blah GINGER blah blah, want <nil>
FAIL
exit status 1
FAIL    archive/foo     0.018s
$
chadwhitacre commented 5 years ago

Alright so front-loading static assignments is bad?

chadwhitacre commented 5 years ago

Static assignments aren't in deps. Guess they'll need to be added.

bd69778f7249a06ee6d39b553dcf9ce2facb2afd

$ ../../../bin/go test
# archive/foo [archive/foo.test]
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
# archive/foo.test
deps:
        tests: []
        benchmarks: []
        examples: []
lout:
out:
PASS
ok      archive/foo     0.023s
$
chadwhitacre commented 5 years ago

610e660aae47a5c3a26c692a1cd00c2669411860

$ time (./make.bash -v > out 2>&1); say 'yeah'

real    4m36.160s
user    8m34.584s
sys     1m20.656s
$
$ ../../../bin/go test
# archive/foo [archive/foo.test]
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
# archive/foo.test
deps:
        tests: []
        benchmarks: []
        examples: []
lout:
out:
PASS
ok      archive/foo     0.013s
$
chadwhitacre commented 5 years ago

Alright, so there are two discrepancies:

chadwhitacre commented 5 years ago

8e2c3dc97d9dd686fa56dfbfda5ba74f8a4f4c49

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
# archive/foo.test
l:
        tests = []testing.InternalTest literal
        benchmarks = []testing.InternalBenchmark literal
        examples = []testing.InternalExample literal
        <node DCLFUNC>
        <node DCLFUNC>
deps:
        tests: []
        benchmarks: []
        examples: []
lout:
out:
PASS
ok      archive/foo     0.014s
$
chadwhitacre commented 5 years ago

213bba32b57351ca8b63166e8fdb535d20c29c3c

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticassign'ing tests []error literal SLICELIT
staticassign'ing statictmp_0 ErrFoo NAME
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
# archive/foo.test
l:
        tests = []testing.InternalTest literal
        benchmarks = []testing.InternalBenchmark literal
        examples = []testing.InternalExample literal
        <node DCLFUNC>
        <node DCLFUNC>
staticassign'ing tests []testing.InternalTest literal SLICELIT
staticassign'ing statictmp_0 foo.TestFoo NAME
staticassign'ing benchmarks []testing.InternalBenchmark literal SLICELIT
staticassign'ing examples []testing.InternalExample literal SLICELIT
deps:
        tests: []
        benchmarks: []
        examples: []
lout:
out:
PASS
ok      archive/foo     0.012s
$
chadwhitacre commented 5 years ago

bbe28373ecc100e49ccc2de1a4edabe1cf1c0928

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah")
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah") false
staticinit'ing tests []error literal
staticassign'ing tests []error literal SLICELIT
staticassign'ing statictmp_0 ErrFoo NAME
staticinit'ing tests []error literal true
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
chadwhitacre commented 5 years ago

550acbbd29eaf6fc5a45ca75612aef3c47336c63

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah")
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah") false
staticinit'ing tests []error literal
staticassign'ing tests []error literal SLICELIT
Here we are: statictmp_0
staticassign'ing statictmp_0 ErrFoo NAME
staticinit'ing tests []error literal true
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
chadwhitacre commented 5 years ago

Alright so we don't get to add statictmp_* to deps here:

https://github.com/chadwhitacre/go/blob/550acbbd29eaf6fc5a45ca75612aef3c47336c63/src/cmd/compile/internal/gc/sinit.go#L94-L100

Because statictmp_* doesn't exist there. πŸ€”

chadwhitacre commented 5 years ago

13d196ac13da31f5087792ba75d294dd290b9d0c

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
seeing n: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
seeing n: errors.New <N>
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah")
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah") false
seeing n: errors.New <N>
seeing n: tests tests = []error literal
seeing n: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
staticinit'ing tests []error literal
staticassign'ing tests []error literal SLICELIT
Here we are: statictmp_0
staticassign'ing statictmp_0 ErrFoo NAME
staticinit'ing tests []error literal true
seeing n: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
deps:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
chadwhitacre commented 5 years ago

https://en.wikipedia.org/wiki/Static_single_assignment_form https://golang.org/doc/go1.7#compiler https://golang.org/doc/go1.8#compiler

chadwhitacre commented 5 years ago

In addition to providing context for ssa, those release notes also demonstrate how to phase in changes across versions should that be necessary here (shouldn't be tho I am thinking now).

chadwhitacre commented 5 years ago

Nope, static never in deps. 0b63817f0c338c1b7c4c0f439c8d24a5d08b6a69

 $ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
seeing: errors.New <N>
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah")
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah") false
seeing: errors.New <N>
seeing: tests tests = []error literal
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
staticinit'ing tests []error literal
staticassign'ing tests []error literal SLICELIT
Here we are: statictmp_0
staticassign'ing statictmp_0 ErrFoo NAME
staticinit'ing tests []error literal true
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
deps first:
        ErrFoo: []
        tests: [ErrFoo]
deps again:
        tests: [ErrFoo]
        ErrFoo: []
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        statictmp_0 = ErrFoo
        ErrFoo = errors.New("blah blah GINGER blah blah")
        tests = []error literal
chadwhitacre commented 5 years ago

5ef21eccd20e33590523b39004a023a03275d5ac πŸ’ƒ

Ready!?!?!?

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
seeing: errors.New <N>
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah")
staticassign'ing ErrFoo errors.New("blah blah GINGER blah blah") CALLFUNC
staticinit'ing ErrFoo errors.New("blah blah GINGER blah blah") false
seeing: errors.New <N>
seeing: tests tests = []error literal
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
staticinit'ing tests []error literal
staticassign'ing tests []error literal SLICELIT
Here we are: statictmp_0
staticassign'ing statictmp_0 ErrFoo NAME
staticinit'ing tests []error literal true
seeing: ErrFoo ErrFoo = errors.New("blah blah GINGER blah blah")
deps first:
        ErrFoo: []
        tests: [ErrFoo]
deps again:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
chadwhitacre commented 5 years ago

b0027df119fe45462b8eb97723cd43d425f76872 builds clean, but doesn't seem to work for the test?

https://gist.github.com/chadwhitacre/8df8132cca9a4ebb71e9732a9f93a6af

$ time (./make.bash -v > out 2>&1); say 'yeah'

real    5m25.411s
user    8m55.092s
sys     1m27.664s
$
$ tail out
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
deps again:
lout:
out:

---
Installed Go for darwin/amd64 in /Users/whit537/workbench/go/src/github.com/golang/go
Installed commands in /Users/whit537/workbench/go/src/github.com/golang/go/bin
$
chadwhitacre commented 5 years ago

7c8b54d215d74d3ef3434dbf81d63d0019be8812

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
deps first:
        ErrFoo: []
        tests: [ErrFoo]
deps again:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
mout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
looking at mout[0], ErrFoo = errors.New("blah blah GINGER blah blah")
looking at mout[0], statictmp_0 = ErrFoo
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo

But ...

$ ../../../bin/go run ../../../test/fixedbugs/issue22326.go 
# command-line-arguments
l:
        a = c + b
        b = f()
        c = f()
        d = 3
        <node DCLFUNC>
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
        a: [c, b]
        c: [f]
        f: [d]
        d: []
        b: [f]
deps again:
        a: [c, b]
        c: []
        f: []
        d: []
        b: []
lout:
        c = f()
        b = f()
        a = c + b
mout:
        c = f()
        b = f()
        a = c + b
looking at mout[0], c = f()
looking at mout[0], b = f()
looking at mout[0], a = c + b
lout:
        c = f()
        b = f()
        a = c + b
out:
        c = f()
        b = f()
        a = c + b
panic: b is 5 not 4

πŸ€”

chadwhitacre commented 5 years ago

ec60174df6ccb01afc814e78f5bc968ad50a202b builds clean and sorts the spec example properly. Will it blend when we flip the switch?

$ ../../../bin/go test
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
deps first:
        ErrFoo: []
        tests: [ErrFoo]
deps again:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
looking at l[0], ErrFoo = errors.New("blah blah GINGER blah blah"): ready? true
out:
        ErrFoo = errors.New("blah blah GINGER blah blah")
# archive/foo.test
l:
        tests = []testing.InternalTest literal
        benchmarks = []testing.InternalBenchmark literal
        examples = []testing.InternalExample literal
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
        tests: []
        benchmarks: []
        examples: []
deps again:
        benchmarks: []
        examples: []
        tests: []
lout:
out:
PASS
ok      archive/foo     0.012s
$
$ ../../../bin/go run ../../../test/fixedbugs/issue22326.go 
# command-line-arguments
l:
        a = c + b
        b = f()
        c = f()
        d = 3
        <node DCLFUNC>
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
        b: [f]
        a: [c, b]
        c: [f]
        f: [d]
        d: []
deps again:
        c: []
        f: []
        d: []
        b: []
        a: [c, b]
lout:
        c = f()
        b = f()
        a = c + b
looking at l[0], a = c + b: ready? false
looking at l[1], b = f(): ready? true
looking at l[1], c = f(): ready? true
looking at l[0], a = c + b: ready? true
out:
        b = f()
        c = f()
        a = c + b
panic: b is 5 not 4

goroutine 1 [running]:
main.expect(...)
        /Users/whit537/workbench/go/src/github.com/golang/go/test/fixedbugs/issue22326.go:25
main.main()
        /Users/whit537/workbench/go/src/github.com/golang/go/test/fixedbugs/issue22326.go:30 +0x269
exit status 2
$
chadwhitacre commented 5 years ago

If not, I think the next step is to go back to logging matches/reorderings during the build to pinpoint the problem.

chadwhitacre commented 5 years ago

Alright this is whack.

https://gist.github.com/chadwhitacre/803619b6ec6bac6f7967a920e37eb5c4

4c80f7f347b66445073310637eb1948b76eaa3bf

chadwhitacre commented 5 years ago

I'm getting panic: assignment to entry in nil map. πŸ˜–

chadwhitacre commented 5 years ago

Five of them.

chadwhitacre commented 5 years ago

Yeah static aren't in l so of course they're not ending up in out. πŸ€”

lout:
        knownFlag = make(map[string]bool)
        Cwd = getwd()
        Interrupted = make(chan struct {})
        statictmp_1 = os.Interrupt
        ToolIsWindows = ToolGOOS == "windows"
        ToolDir = build.ToolDir
looking at m[0], knownFlag = make(map[string]bool): ready? true
looking at m[0], Cwd = getwd(): ready? true
looking at m[0], Interrupted = make(chan struct {}): ready? true
looking at m[0], ToolIsWindows = ToolGOOS == "windows": ready? true
looking at m[0], ToolDir = build.ToolDir: ready? true
out:
        knownFlag = make(map[string]bool)
        Cwd = getwd()
        Interrupted = make(chan struct {})
        ToolIsWindows = ToolGOOS == "windows"
        ToolDir = build.ToolDir
chadwhitacre commented 5 years ago

70d7e2867b398f42b8a349879a119358ac77f272 ☺️

$ ../../../bin/go run ../../../test/fixedbugs/issue22326.go 
# command-line-arguments
l:
        a = c + b
        b = f()
        c = f()
        d = 3
        <node DCLFUNC>
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
        a: [c, b]
        c: [f]
        f: [d]
        d: []
        b: [f]
deps again:
        a: [c, b]
        c: []
        f: []
        d: []
        b: []
lout:
        c = f()
        b = f()
        a = c + b
out:
        b = f()
        c = f()
        a = c + b
$
# archive/foo [archive/foo.test]
l:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        <node DCLFUNC>
        tests = []error literal
        <node DCLFUNC>
deps first:
        ErrFoo: []
        tests: [ErrFoo]
deps again:
        ErrFoo: []
        tests: [ErrFoo]
lout:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
out:
        ErrFoo = errors.New("blah blah GINGER blah blah")
        statictmp_0 = ErrFoo
# archive/foo.test
l:
        tests = []testing.InternalTest literal
        benchmarks = []testing.InternalBenchmark literal
        examples = []testing.InternalExample literal
        <node DCLFUNC>
        <node DCLFUNC>
deps first:
        tests: []
        benchmarks: []
        examples: []
deps again:
        tests: []
        benchmarks: []
        examples: []
lout:
out:
PASS
ok      archive/foo     0.012s
$
chadwhitacre commented 5 years ago

I believe the reason that bumping static to after dynamic didn't work the first time I tried it (it was basically the first thing I tried) is because there was also the bug with remove reordering the array.

chadwhitacre commented 5 years ago

I think aa99da8fe35923624d80aded5d8f414d755a1fa3 might be it! Builds clean and is currently churning through all.bash. πŸ‘

$ go run test/run.go -- test/fixedbugs/issue22326.go 
$
chadwhitacre commented 5 years ago

😍

##### Testing packages.
ok      archive/tar     0.125s
ok      archive/zip     6.976s
ok      bufio   0.171s
ok      bytes   1.044s
chadwhitacre commented 5 years ago

Hmm ... spurious fail? πŸ€”

panic: test timed out after 9m0s
$ time (./all.bash -v > out 2>&1); say 'yeah'

real    20m46.132s
user    40m12.451s
sys     9m26.833s
$
chadwhitacre commented 5 years ago
/Users/whit537/workbench/go/src/github.com/golang/go/src/os/signal
total 68
-rw-r--r--  1 whit537  wheel  10630 Nov 25 08:10 doc.go
-rw-r--r--  1 whit537  wheel   1001 Nov 25 08:12 example_test.go
drwxr-xr-x  3 whit537  wheel     96 Nov 25 08:12 internal/
-rw-r--r--  1 whit537  wheel    410 Nov 25 08:10 sig.s
-rw-r--r--  1 whit537  wheel   5791 Nov 25 08:12 signal.go
-rw-r--r--  1 whit537  wheel   6187 Nov 25 08:12 signal_cgo_test.go
-rw-r--r--  1 whit537  wheel   1068 Nov 25 08:12 signal_plan9.go
-rw-r--r--  1 whit537  wheel   3911 Nov 25 08:10 signal_plan9_test.go
-rw-r--r--  1 whit537  wheel  12826 Jan  3 16:06 signal_test.go
-rw-r--r--  1 whit537  wheel   1101 Nov 25 08:12 signal_unix.go
-rw-r--r--  1 whit537  wheel   2108 Nov 25 08:10 signal_windows_test.go
$ ../../../bin/go test
chadwhitacre commented 5 years ago

Yeah this only took a few seconds before:

https://github.com/chadwhitacre/go/pull/3#issuecomment-451688222

https://gist.github.com/chadwhitacre/3c01d78c29ed9fa7d091e466020d0761#file-out-L832