1
0
mirror of https://github.com/golang/go synced 2024-11-24 03:40:16 -07:00
go/test/fixedbugs
David Chase e779bfa5d2 cmd/compile: better modeling of escape across loop levels
Brief background on "why heap allocate".  Things can be
forced to the heap for the following reasons:

1) address published, hence lifetime unknown.
2) size unknown/too large, cannot be stack allocated
3) multiplicity unknown/too large, cannot be stack allocated
4) reachable from heap (not necessarily published)

The bug here is a case of failing to enforce 4) when an
object Y was reachable from a heap allocation X forced
because of 3).  It was found in the case of a closure
allocated within a loop (X) and assigned to a variable
outside the loop (multiplicity unknown) where the closure
also captured a map (Y) declared outside the loop (reachable
from heap). Note the variable declared outside the loop (Y)
is not published, has known size, and known multiplicity
(one). The only reason for heap allocation is that it was
reached from a heap allocated item (X), but because that was
not forced by publication, it has to be tracked by loop
level, but escape-loop level was not tracked and thus a bug
results.

The fix is that when a heap allocation is newly discovered,
use its looplevel as the minimum loop level for downstream
escape flooding.

Every attempt to generalize this bug to X-in-loop-
references-Y-outside loop succeeded, so the fix was aimed
to be general.  Anywhere that loop level forces heap
allocation, the loop level is tracked.  This is not yet
tested for all possible X and Y, but it is correctness-
conservative and because it caused only one trivial
regression in the escape tests, it is probably also
performance-conservative.

The new test checks the following:
1) in the map case, that if fn escapes, so does the map.
2) in the map case, if fn does not escape, neither does the map.
3) in the &x case, that if fn escapes, so does &x.
4) in the &x case, if fn does not escape, neither does &x.

Fixes #13799.

Change-Id: Ie280bef2bb86ec869c7c206789d0b68f080c3fdb
Reviewed-on: https://go-review.googlesource.com/18234
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13 04:01:00 +00:00
..
bug083.dir
bug088.dir
bug106.dir
bug133.dir
bug160.dir
bug191.dir
bug222.dir
bug248.dir
bug282.dir
bug302.dir
bug306.dir
bug313.dir
bug322.dir
bug324.dir
bug335.dir
bug345.dir
bug367.dir
bug369.dir
bug377.dir
bug382.dir
bug392.dir
bug396.dir
bug404.dir
bug407.dir
bug414.dir
bug415.dir
bug424.dir
bug437.dir
bug448.dir
bug460.dir
bug465.dir
bug466.dir
bug467.dir
bug468.dir
bug472.dir
bug478.dir
bug479.dir
bug480.dir
bug488.dir
bug492.dir
gcc67968.dir test: add gcc6798, valid code that caused gccgo to crash 2015-11-01 21:17:01 +00:00
issue3552.dir
issue4252.dir
issue4326.dir
issue4370.dir
issue4510.dir
issue4590.dir
issue4879.dir
issue4932.dir
issue4964.dir test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue5105.dir
issue5125.dir
issue5259.dir
issue5260.dir
issue5291.dir
issue5470.dir
issue5614.dir
issue5755.dir
issue5910.dir
issue5957.dir test: adjust gccgo expected import errors 2015-10-07 14:37:44 +00:00
issue6295.dir
issue6513.dir
issue6789.dir
issue7023.dir
issue7648.dir
issue7995b.dir test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue8060.dir
issue8280.dir
issue9355.dir
issue9537.dir
issue9608.dir
issue10066.dir
issue10219.dir
issue10700.dir
issue11053.dir
issue12677.dir cmd/compile: fix export type conversion loss in inlined func body 2015-12-16 20:30:04 +00:00
issue13777.dir cmd/compile: suppress export of Note field within exported bodies 2016-01-05 15:42:12 +00:00
bug000.go
bug002.go
bug003.go
bug004.go
bug005.go
bug006.go
bug007.go
bug008.go
bug009.go
bug010.go
bug011.go
bug012.go
bug013.go
bug014.go
bug015.go
bug016.go
bug017.go
bug020.go
bug021.go
bug022.go
bug023.go
bug024.go
bug026.go
bug027.go
bug028.go
bug030.go
bug031.go
bug035.go
bug037.go
bug039.go
bug040.go
bug045.go
bug046.go
bug047.go
bug048.go
bug049.go
bug050.go
bug051.go
bug052.go
bug053.go
bug054.go
bug055.go
bug056.go
bug057.go
bug058.go
bug059.go
bug060.go
bug061.go
bug062.go
bug063.go
bug064.go
bug065.go
bug066.go
bug067.go
bug068.go
bug069.go
bug070.go
bug071.go
bug072.go
bug073.go
bug074.go
bug075.go
bug076.go
bug077.go
bug078.go
bug080.go
bug081.go
bug082.go
bug083.go
bug084.go
bug085.go
bug086.go
bug087.go
bug088.go
bug089.go
bug090.go
bug091.go
bug092.go
bug093.go
bug094.go
bug096.go
bug097.go
bug098.go
bug099.go
bug101.go
bug102.go
bug103.go
bug104.go
bug106.go
bug107.go
bug108.go
bug109.go
bug110.go
bug111.go
bug112.go
bug113.go
bug114.go
bug115.go
bug116.go
bug117.go
bug118.go
bug119.go
bug120.go
bug121.go
bug122.go
bug123.go
bug126.go
bug127.go
bug128.go
bug129.go
bug130.go
bug131.go
bug132.go
bug133.go
bug135.go
bug136.go
bug137.go
bug139.go
bug140.go
bug141.go
bug142.go
bug143.go
bug144.go
bug145.go
bug146.go
bug147.go
bug148.go
bug149.go
bug150.go
bug151.go
bug152.go
bug154.go
bug155.go
bug156.go
bug157.go
bug158.go
bug159.go
bug160.go
bug161.go
bug163.go
bug164.go
bug165.go
bug167.go
bug168.go
bug169.go
bug170.go
bug171.go
bug172.go
bug173.go
bug174.go
bug175.go
bug176.go
bug177.go
bug178.go
bug179.go
bug180.go
bug181.go
bug182.go
bug183.go
bug184.go
bug185.go
bug186.go
bug187.go
bug188.go
bug189.go
bug190.go
bug191.go
bug192.go
bug193.go
bug194.go
bug195.go
bug196.go
bug197.go
bug198.go
bug199.go
bug200.go
bug201.go
bug202.go
bug203.go
bug204.go
bug205.go
bug206.go
bug206.out
bug207.go
bug208.go
bug209.go
bug211.go
bug212.go
bug213.go
bug214.go
bug215.go
bug216.go
bug217.go
bug218.go
bug219.go
bug221.go
bug222.go
bug223.go
bug224.go
bug225.go
bug227.go
bug228.go
bug229.go
bug230.go
bug231.go
bug232.go
bug233.go
bug234.go
bug235.go
bug236.go
bug237.go
bug238.go
bug239.go
bug240.go
bug241.go
bug242.go
bug243.go
bug244.go
bug245.go
bug246.go
bug247.go
bug248.go
bug249.go
bug250.go
bug251.go
bug252.go
bug253.go
bug254.go
bug255.go
bug256.go
bug257.go
bug258.go
bug259.go
bug260.go
bug261.go
bug262.go
bug263.go
bug264.go
bug265.go
bug266.go
bug267.go
bug269.go
bug271.go
bug272.go
bug273.go
bug274.go
bug275.go
bug276.go
bug277.go
bug278.go
bug279.go
bug280.go
bug281.go
bug282.go
bug283.go
bug284.go
bug285.go
bug286.go
bug287.go
bug288.go
bug289.go
bug290.go
bug291.go
bug292.go
bug293.go
bug294.go
bug295.go
bug296.go
bug297.go
bug298.go
bug299.go
bug300.go
bug301.go
bug302.go
bug303.go
bug304.go
bug305.go
bug306.go
bug307.go
bug308.go
bug309.go
bug311.go
bug312.go
bug313.go
bug314.go
bug315.go
bug316.go
bug317.go
bug318.go
bug319.go
bug320.go
bug321.go
bug322.go
bug323.go
bug324.go
bug325.go
bug326.go
bug327.go
bug328.go
bug328.out
bug329.go
bug330.go
bug331.go
bug332.go
bug333.go
bug334.go
bug335.go
bug336.go
bug337.go
bug338.go
bug339.go
bug340.go
bug341.go
bug342.go
bug343.go
bug344.go
bug345.go
bug346.go
bug347.go
bug348.go
bug349.go
bug350.go
bug351.go
bug352.go
bug353.go
bug354.go
bug355.go
bug356.go
bug357.go
bug358.go cmd/compile/internal/gc: recursive-descent parser 2015-11-13 14:53:57 +00:00
bug361.go
bug362.go
bug363.go
bug364.go
bug365.go
bug366.go
bug367.go
bug368.go
bug369.go
bug370.go
bug371.go
bug372.go
bug373.go
bug374.go
bug375.go
bug376.go
bug377.go
bug378.go
bug379.go
bug380.go
bug381.go
bug382.go
bug383.go
bug384.go
bug385_32.go
bug385_64.go
bug386.go
bug387.go
bug388.go
bug389.go
bug390.go
bug391.go
bug392.go
bug393.go
bug394.go
bug396.go
bug397.go
bug398.go
bug399.go
bug401.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
bug402.go
bug403.go
bug404.go
bug405.go
bug406.go
bug407.go
bug409.go
bug409.out
bug410.go
bug411.go
bug412.go
bug413.go
bug414.go
bug415.go
bug416.go
bug417.go
bug418.go
bug419.go
bug420.go
bug421.go
bug422.go
bug423.go
bug424.go
bug425.go
bug426.go
bug427.go
bug428.go
bug429_run.go
bug429.go
bug430.go
bug431.go
bug432.go
bug433.go
bug434.go
bug435.go
bug436.go
bug437.go
bug438.go
bug439.go
bug440_32.go
bug440_64.go
bug441.go
bug442.go
bug443.go
bug444.go
bug445.go
bug446.go
bug447.go
bug448.go
bug449.go
bug450.go
bug451.go
bug452.go
bug453.go
bug454.go
bug455.go
bug456.go
bug457.go
bug458.go
bug459.go
bug460.go
bug461.go
bug462.go
bug463.go
bug464.go
bug465.go
bug466.go
bug467.go
bug468.go
bug470.go
bug471.go
bug472.go
bug473.go
bug474.go
bug475.go
bug476.go
bug477.go
bug478.go
bug479.go
bug480.go
bug481.go
bug482.go
bug483.go
bug484.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
bug485.go
bug486.go
bug487.go
bug488.go
bug489.go
bug490.go
bug491.go
bug492.go
bug493.go
bug494.go
bug495.go
bug496.go test: add another test that gccgo failed to compile 2015-11-20 13:31:30 +00:00
bug497.go test: add test that gccgo miscompiled 2015-12-22 00:03:45 +00:00
bug1515.go
bug13343.go cmd/compile/internal/gc: fix initialization logic 2016-01-06 02:10:52 +00:00
gcc61204.go
gcc61244.go
gcc61246.go
gcc61248.go
gcc61253.go
gcc61254.go
gcc61255.go
gcc61258.go
gcc61264.go
gcc61265.go
gcc61273.go
gcc65755.go
gcc67968.go test: add gcc6798, valid code that caused gccgo to crash 2015-11-01 21:17:01 +00:00
issue887.go
issue1304.go
issue2615.go
issue3552.go
issue3705.go
issue3783.go
issue3925.go
issue4066.go
issue4085a.go
issue4085b.go
issue4097.go
issue4099.go
issue4162.go
issue4167.go
issue4232.go
issue4251.go
issue4252.go
issue4264.go
issue4283.go
issue4313.go
issue4316.go
issue4323.go
issue4326.go
issue4348.go
issue4353.go
issue4359.go
issue4365.go
issue4370.go
issue4388.go
issue4396a.go
issue4396b.go
issue4399.go
issue4405.go
issue4429.go
issue4448.go
issue4452.go
issue4458.go
issue4463.go
issue4468.go cmd/compile/internal/gc: better error message for parenthesized go/defer exprs 2015-11-18 22:26:07 +00:00
issue4470.go
issue4495.go
issue4510.go
issue4517a.go
issue4517b.go
issue4517c.go
issue4517d.go
issue4518.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue4529.go
issue4545.go
issue4562.go
issue4585.go
issue4590.go
issue4610.go
issue4614.go
issue4618.go
issue4620.go
issue4654.go
issue4663.go
issue4667.go
issue4734.go
issue4748.go
issue4752.go
issue4776.go
issue4785.go
issue4813.go
issue4847.go
issue4879.go
issue4909a.go
issue4909b.go
issue4932.go
issue4964.go
issue5002.go
issue5056.go
issue5089.go
issue5105.go
issue5125.go
issue5162.go
issue5172.go
issue5231.go
issue5244.go
issue5259.go
issue5260.go
issue5291.go
issue5358.go
issue5373.go
issue5470.go
issue5493.go
issue5515.go
issue5581.go
issue5607.go
issue5609.go
issue5614.go
issue5698.go
issue5704.go
issue5753.go
issue5755.go
issue5793.go
issue5809.go
issue5820.go
issue5841.go
issue5856.go
issue5910.go
issue5957.go
issue5963.go
issue6004.go
issue6036.go
issue6055.go
issue6131.go
issue6140.go
issue6247.go
issue6269.go
issue6295.go
issue6298.go
issue6399.go
issue6402.go
issue6403.go
issue6405.go
issue6406.go
issue6500.go
issue6513.go
issue6572.go
issue6671.go
issue6703a.go
issue6703b.go
issue6703c.go
issue6703d.go
issue6703e.go
issue6703f.go
issue6703g.go
issue6703h.go
issue6703i.go
issue6703j.go
issue6703k.go
issue6703l.go
issue6703m.go
issue6703n.go
issue6703o.go
issue6703p.go
issue6703q.go
issue6703r.go
issue6703s.go
issue6703t.go
issue6703u.go
issue6703v.go
issue6703w.go
issue6703x.go
issue6703y.go
issue6703z.go
issue6789.go
issue6847.go
issue6866.go
issue6889.go
issue6899.go
issue6899.out
issue6902.go
issue6964.go
issue7023.go
issue7044.go
issue7050.go
issue7083.go
issue7129.go
issue7150.go cmd/compile: clearer error for invalid array/slice literal elements 2015-11-25 19:49:38 +00:00
issue7153.go cmd/compile: clearer error for invalid array/slice literal elements 2015-11-25 19:49:38 +00:00
issue7214.go
issue7223.go
issue7272.go
issue7310.go
issue7316.go
issue7346.go
issue7366.go
issue7405.go
issue7419.go
issue7525.go
issue7538a.go
issue7538b.go
issue7547.go
issue7550.go
issue7590.go
issue7648.go
issue7675.go
issue7690.go
issue7740.go
issue7742.go
issue7746.go
issue7760.go
issue7794.go
issue7863.go
issue7867.go
issue7884.go
issue7944.go
issue7995.go
issue7995b.go
issue7996.go
issue7997.go
issue7998.go
issue8004.go
issue8011.go
issue8017.go
issue8028.go
issue8036.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue8039.go
issue8047.go
issue8047b.go
issue8048.go
issue8060.go
issue8073.go
issue8074.go
issue8076.go
issue8079.go
issue8132.go
issue8139.go
issue8154.go
issue8155.go
issue8158.go
issue8183.go
issue8280.go
issue8311.go
issue8325.go
issue8336.go
issue8347.go
issue8385.go
issue8475.go
issue8501.go
issue8507.go
issue8612.go
issue8620.go
issue8745.go
issue8761.go
issue8836.go
issue8947.go
issue8961.go
issue9006.go
issue9017.go
issue9036.go
issue9076.go
issue9083.go
issue9110.go
issue9321.go
issue9355.go
issue9370.go
issue9432.go
issue9521.go
issue9537.go
issue9604.go
issue9604b.go
issue9608.go
issue9634.go
issue9691.go
issue9731.go
issue9738.go
issue9862_run.go
issue9862.go
issue10047.go
issue10066.go
issue10135.go
issue10219.go
issue10253.go
issue10284.go
issue10320.go
issue10332.go
issue10353.go
issue10407.go
issue10441.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue10486.go runtime: change arm software div/mod call sequence not to modify stack 2015-07-30 16:14:05 +00:00
issue10607.go test: fix nosplit.go, fixedbugs/issue11656.go and skip two tests for mips64{,le} 2015-11-12 04:52:31 +00:00
issue10607a.go cmd/link: if -B option was used, pass it to the external linker 2015-07-21 03:57:55 +00:00
issue10654.go
issue10700.go
issue10925.go
issue10975.go test: gofmt fixedbugs/issue10975.go 2015-10-06 06:56:11 +00:00
issue10977.go
issue11053.go
issue11053.out
issue11256.go
issue11286.go
issue11326.go cmd/compile: don't truncate tiny float constants to 0 in error messages 2015-12-10 16:39:46 +00:00
issue11326b.go src/cmd/compile/internal/gc: remove now unnecessary restriction on float exponent parsing 2015-09-22 00:22:49 +00:00
issue11359.go cmd/compile: reject identifiers beginning with non-ASCII digit 2015-11-16 20:38:42 +00:00
issue11362.go cmd/compile: fix some C to Go translation leftovers 2015-10-08 01:51:24 +00:00
issue11369.go
issue11590.go cmd/compile: don't truncate tiny float constants to 0 in error messages 2015-12-10 16:39:46 +00:00
issue11610.go cmd/compile/internal/gc: fix internal compiler error on invalid declaration 2015-12-07 20:21:21 +00:00
issue11614.go cmd/compile/internal/gc: fix panic in Type Stringer 2015-12-07 20:18:03 +00:00
issue11656.go test: fix nosplit.go, fixedbugs/issue11656.go and skip two tests for mips64{,le} 2015-11-12 04:52:31 +00:00
issue11699.go cmd/compile: do not emit args_stackmap for func _ 2015-11-16 20:38:52 +00:00
issue11737.go cmd/compile: diagnose invalid switch interface{} case earlier 2015-12-16 20:58:00 +00:00
issue11750.go cmd/compile: prepend captured args to called-closure params 2015-07-23 19:02:19 +00:00
issue11771.go
issue11790.go cmd/compile: adjust annotation of implicit operations. 2015-07-23 14:19:07 +00:00
issue11987.go cmd/internal/obj/ppc64: fix assembly of SRADCC with immediate 2015-11-05 22:54:21 +00:00
issue12006.go cmd/compile: escape analysis, don't always escape variadic args 2015-10-04 20:45:35 +00:00
issue12108.go cmd/compile/internal/ppc64: fix the epilogue for non-leaf generated methods 2015-10-06 03:34:13 +00:00
issue12133.go test: use go:noinline consistently 2015-11-03 02:01:34 +00:00
issue12226.go cmd/compile: fix register allocation for == operator 2015-08-25 18:10:14 +00:00
issue12411.go cmd/compile: fix magic multiply smashing AX 2015-12-16 20:58:17 +00:00
issue12413.go cmd/compile: "invalid variable name x in type switch", where x is a name of a constant 2015-10-21 04:21:16 +00:00
issue12577.go cmd/compile/internal/gc: there are no -0 floating-point constants 2015-10-20 22:11:11 +00:00
issue12588.go cmd/compile: repair escape analysis of range &fixedArray 2015-10-01 18:49:18 +00:00
issue12677.go cmd/compile: fix export type conversion loss in inlined func body 2015-12-16 20:30:04 +00:00
issue12686.go cmd/compile: fix Val vs Opt collision 2015-11-18 18:31:27 +00:00
issue12944.go cmd/compile/internal/gc: reject invalid unsafe.Sizeof([0]byte{}[0]) 2015-10-15 20:56:58 +00:00
issue13160.go runtime: memmove/memclr pointers atomically 2015-11-07 02:42:12 +00:00
issue13169.go runtime: simplify chan ops, take 2 2015-11-08 23:20:25 +00:00
issue13171.go runtime: teach peephole optimizer that duffcopy clobbers X0 2015-11-06 15:11:42 +00:00
issue13248.go test: add test case for issue #13248 2015-11-17 01:05:51 +00:00
issue13261.go cmd/compile/internal/gc: fix incorrect parsing of &(T{}) when followed by { 2015-11-18 22:25:48 +00:00
issue13266.go cmd/compile/internal/gc: correctly use internal call to error reporting 2015-11-17 01:05:07 +00:00
issue13268.go test: add test case for issue 13268 2015-11-24 04:14:39 +00:00
issue13273.go cmd/compile/internal/gc: fix parsing of <-x (recv op vs recv-only chan) 2015-11-18 22:22:56 +00:00
issue13274.go cmd/compile/internal/gc: don't ignore EOF in new parser 2015-11-17 01:05:39 +00:00
issue13319.go cmd/compile: better syntax error recovery 2015-11-20 19:56:27 +00:00
issue13365.go cmd/compile: clearer error for invalid array/slice literal elements 2015-11-25 19:49:38 +00:00
issue13415.go cmd/compile: use correct line number for := (LCOLAS) 2015-11-28 03:36:00 +00:00
issue13471.go cmd/compile: don't truncate tiny float constants to 0 in error messages 2015-12-10 16:39:46 +00:00
issue13480.go cmd/compile: reject slice/map/func comparisons against converted nil 2015-12-05 05:46:48 +00:00
issue13539.go cmd/compile: recognize labels even if they have the same name as packages 2015-12-09 02:02:11 +00:00
issue13559.go cmd/compile: don't truncate tiny float constants to 0 in error messages 2015-12-10 16:39:46 +00:00
issue13587.go cmd/compile: add missing write barriers for return statements 2015-12-12 06:46:56 +00:00
issue13684.go cmd/compile: const name and label name may match 2015-12-21 20:21:28 +00:00
issue13777.go cmd/compile: suppress export of Note field within exported bodies 2016-01-05 15:42:12 +00:00
issue13799.go cmd/compile: better modeling of escape across loop levels 2016-01-13 04:01:00 +00:00
issue13821.go cmd/compile: recognize bool(true) as a constant expression 2016-01-06 14:38:33 +00:00
issue13821b.go cmd/compile: recognize !typedbool is typed 2016-01-07 21:43:47 +00:00