github-vet / github-vet/rangeloop-pointer-findings
naredula-jana/Golang-Ring0: go1.14.2/src/cmd/compile/internal/ssa/compile.go; 72 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [naredula-jana/Golang-Ring0](https://www.github.com/naredula-jana/Golang-Ring0) at [go1.14.2/src/cmd/compile/internal/ssa/compile.go](https://github.com/naredula-jana/Golang-Ring0/blob/fdc9cdad1a4f27eaa4105d0b5c96a075d2e8414f/go1.14.2/src/cmd/compile/internal/ssa/compile.go#L65-L136)
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 69
[Click here to see the code in its original context.](https://github.com/naredula-jana/Golang-Ring0/blob/fdc9cdad1a4f27eaa4105d0b5c96a075d2e8414f/go1.14.2/src/cmd/compile/internal/ssa/compile.go#L65-L136)
Click here to show the 72 line(s) of Go which triggered the analyzer.
```go
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)
}
if checkEnabled && !f.scheduled {
// Test that we don't depend on the value order, by randomizing
// the order of values in each block. See issue 18169.
for _, b := range f.Blocks {
for i := 0; i < len(b.Values)-1; i++ {
j := i + rnd.Intn(len(b.Values)-i)
b.Values[i], b.Values[j] = b.Values[j], b.Values[i]
}
}
}
tStart := time.Now()
p.fn(f)
tEnd := time.Now()
// Need something less crude than "Log the whole intermediate result".
if f.Log() || f.HTMLWriter != 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)
}
if f.Log() {
f.Logf(" pass %s end %s\n", p.name, stats)
printFunc(f)
}
f.HTMLWriter.WriteFunc(phaseName, fmt.Sprintf("%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 {
checkFunc(f)
}
}
```
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: fdc9cdad1a4f27eaa4105d0b5c96a075d2e8414f
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.