github-vet / github-vet/rangeloop-pointer-findings

EnjoyLifeFund/ubuntu-17-cellars: go/1.8.1/libexec/pkg/bootstrap/src/bootstrap/cmd/compile/internal/ssa/compile.go; 59 LoC

Open
#10,019 0 comments 0 reactions 0 assignees View on GitHub
fresh medium
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [EnjoyLifeFund/ubuntu-17-cellars](https://www.github.com/EnjoyLifeFund/ubuntu-17-cellars) at [go/1.8.1/libexec/pkg/bootstrap/src/bootstrap/cmd/compile/internal/ssa/compile.go](https://github.com/EnjoyLifeFund/ubuntu-17-cellars/blob/39bc64dd740d91e7178c32e488b0c7b098163d01//tmp/go-20170517-18751-tjx0zu/go/src/cmd/compile/internal/ssa/compile.go#L53-L111)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.

> reference to p is reassigned at line 57

[Click here to see the code in its original context.](https://github.com/EnjoyLifeFund/ubuntu-17-cellars/blob/39bc64dd740d91e7178c32e488b0c7b098163d01//tmp/go-20170517-18751-tjx0zu/go/src/cmd/compile/internal/ssa/compile.go#L53-L111)

Click here to show the 59 line(s) of Go which triggered the analyzer.

```go
checkFunc(f)
}
const logMemStats = false
for _, p := range passes {
if !f.Config.optimize && !p.required || p.disabled {
continue
}
f.pass = &p
phaseName = p.name
if f.Log() {
f.Logf(" pass %s begin\n", p.name)
}
// TODO: capture logging during this pass, add it to the HTML
var mStart runtime.MemStats
if logMemStats || p.mem {
runtime.ReadMemStats(&mStart)
}

tStart := time.Now()
p.fn(f)
tEnd := time.Now()

// Need something less crude than "Log the whole intermediate result".
if f.Log() || f.Config.HTML != nil {
time := tEnd.Sub(tStart).Nanoseconds()
var stats string
if logMemStats {
var mEnd runtime.MemStats
runtime.ReadMemStats(&mEnd)
nBytes := mEnd.TotalAlloc - mStart.TotalAlloc
nAllocs := mEnd.Mallocs - mStart.Mallocs
stats = fmt.Sprintf("[%d ns %d allocs %d bytes]", time, nAllocs, nBytes)
} else {
stats = fmt.Sprintf("[%d ns]", time)
}

f.Logf(" pass %s end %s\n", p.name, stats)
printFunc(f)
f.Config.HTML.WriteFunc(fmt.Sprintf("after %s %s", phaseName, stats), f)
}
if p.time || p.mem {
// Surround timing information w/ enough context to allow comparisons.
time := tEnd.Sub(tStart).Nanoseconds()
if p.time {
f.LogStat("TIME(ns)", time)
}
if p.mem {
var mEnd runtime.MemStats
runtime.ReadMemStats(&mEnd)
nBytes := mEnd.TotalAlloc - mStart.TotalAlloc
nAllocs := mEnd.Mallocs - mStart.Mallocs
f.LogStat("TIME(ns):BYTES:ALLOCS", time, nBytes, nAllocs)
}
}
if p.dump != nil && p.dump[f.Name] {
// Dump function to appropriately named file
f.dumpFile(phaseName)
}
if checkEnabled {

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 39bc64dd740d91e7178c32e488b0c7b098163d01

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.