mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
compiler: fix a race condition
There was a mostly benign race condition in the compiler. The issue was that there is a check for type aliases (which can alias types in another function), but this check was _after_ accessing a property of the function that might not have been completed. I don't think this can have any serious effects, as the function is skipped anyway, but such bugs should certainly be fixed.
This commit is contained in:
committed by
Ron Evans
parent
1cb702ac4c
commit
8babc47638
@@ -869,14 +869,14 @@ func (c *compilerContext) createPackage(irbuilder llvm.Builder, pkg *ssa.Package
|
||||
if fn == nil {
|
||||
continue // probably a generic method
|
||||
}
|
||||
if fn.Blocks == nil {
|
||||
continue // external function
|
||||
}
|
||||
if member.Type().String() != member.String() {
|
||||
// This is a member on a type alias. Do not build such a
|
||||
// function.
|
||||
continue
|
||||
}
|
||||
if fn.Blocks == nil {
|
||||
continue // external function
|
||||
}
|
||||
if fn.Synthetic != "" && fn.Synthetic != "package initializer" {
|
||||
// This function is a kind of wrapper function (created by
|
||||
// the ssa package, not appearing in the source code) that
|
||||
|
||||
Reference in New Issue
Block a user