Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
gccgo tip:
go version go1.8.3 gccgo (GCC) 8.0.0 20170727 (experimental) linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOHOSTARCH="amd64"
GOOS="linux"
What did you do?
Compiled this fragment:
package foo
import "unsafe"
func bar() int {
good := int(1) << (uint64(unsafe.Sizeof(0)-1) * 8)
bad := 1 << (uint64(unsafe.Sizeof(0)-1) * 8)
return good + bad
}
with "go build -compiler gccgo"
What did you expect to see?
successful build
What did you see instead?
crash with this stack trace
# command-line-arguments
go1: internal compiler error: in do_get_backend, at go/gofrontend/types.cc:4048
0x9bd50f Integer_type::do_get_backend(Gogo*)
../../gcc-trunk/gcc/go/gofrontend/types.cc:4048
0x9b3ff8 Type::get_btype_without_hash(Gogo*)
../../gcc-trunk/gcc/go/gofrontend/types.cc:965
0x9b3f35 Type::get_backend(Gogo*)
../../gcc-trunk/gcc/go/gofrontend/types.cc:934
0x8ee92b Binary_expression::do_get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/expressions.cc:6023
0x8e10e6 Expression::get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/expressions.cc:402
0x8e7a79 Type_conversion_expression::do_get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/expressions.cc:3495
0x8e10e6 Expression::get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/expressions.cc:402
0x94efa3 Variable::get_init(Gogo*, Named_object*)
../../gcc-trunk/gcc/go/gofrontend/gogo.cc:6703
0x99bbc3 Variable_declaration_statement::do_get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/statements.cc:292
0x99b772 Statement::get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/statements.cc:142
0x94d8ca Block::get_backend(Translate_context*)
../../gcc-trunk/gcc/go/gofrontend/gogo.cc:6155
0x94c0c7 Function::build(Gogo*, Named_object*)
../../gcc-trunk/gcc/go/gofrontend/gogo.cc:5758
0x9513d4 Named_object::get_backend(Gogo*, std::vector<Bexpression*, std::allocator<Bexpression*> >&, std::vector<Btype*, std::allocator<Btype*> >&, std::vector<Bfunction*, std::allocator<Bfunction*> >&)
../../gcc-trunk/gcc/go/gofrontend/gogo.cc:7551
0x93ed51 Gogo::write_globals()
../../gcc-trunk/gcc/go/gofrontend/gogo.cc:1354
0x938875 go_write_globals()
../../gcc-trunk/gcc/go/gofrontend/go.cc:177
0x92f1d3 go_langhook_parse_file
../../gcc-trunk/gcc/go/go-lang.c:327
From poking around in the debugger it appears that the type of the left operand of the shift is still an abstract in type, for what that's worth.