You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: internal compiler error: untyped type mismatch, have: untyped float, want: untyped int #41680
Thanks. Looks like this is related to a pre-existing type-checking bug related to make. For example, this program is valid and type checks with gccgo and go/types, but not with Go 1.15:
package main
func main() {
const n = 1e5
_ = make([]int, n)
f := n
var _ float64 = f
}
Edit: Go 1.15's error message is:
x.go:7:6: cannot use f (type int) as type float64 in assignment
(Positively, it successfully compiles at tip, likely thanks to CL 255217.)
@cuonglm No, that's the issue. If a Node has type Idealfloat, then it should have value CTFLT.
So I think that's the bug here. I can't find where we currently set that information. This bug does exists before CL 255217, it just works because we assign the value to n instead of doing assertion.
Activity
ianlancetaylor commentedon Sep 28, 2020
Sorry, I forgot to include the compilation error.
mdempsky commentedon Sep 28, 2020
Thanks. Looks like this is related to a pre-existing type-checking bug related to
make. For example, this program is valid and type checks with gccgo and go/types, but not with Go 1.15:Edit: Go 1.15's error message is:
(Positively, it successfully compiles at tip, likely thanks to CL 255217.)
cuonglm commentedon Sep 28, 2020
@mdempsky Is it normal that
const n = 1e5is untyped float, but then.Val().Ctype()isCTINT?mdempsky commentedon Sep 28, 2020
@cuonglm No, that's the issue. If a Node has type Idealfloat, then it should have value CTFLT.
cuonglm commentedon Sep 28, 2020
So I think that's the bug here. I can't find where we currently set that information. This bug does exists before CL 255217, it just works because we assign the value to n instead of doing assertion.
mdempsky commentedon Sep 28, 2020
@cuonglm That's my assessment too. I have a fix. Will upload shortly.
gopherbot commentedon Sep 28, 2020
Change https://golang.org/cl/257966 mentions this issue:
cmd/compile: fix type checking of "make" argumentscmd/compile: fix type checking of "make" arguments