https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83071
Bug ID: 83071 Summary: gccgo: ICE in set_type Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: pmatos at gcc dot gnu.org CC: cmang at google dot com Target Milestone: --- I have written a very simple program in Go and somehow I surprisingly managed to crash the compiler. This is my first Go program so maybe I am playing outside the normal rules... still, it shouldn't ICE. asmparser.go: ---------------- package asmparser import "container/list" // Structure representing assembler files // An AsmFile is a list of assembler specific keywords and labels interspersed with // architectural specific instructions. type AsmFile list.List // Interface for entrie type AsmEntry struct { lineno int entry *Entry } type Entry interface { isInsn() bool isKeyword() bool isLabel() bool } type Insn struct { mnemonic string args list.List } func (insn Insn) isInsn() bool { return true } func (insn Insn) isKeyword() bool { return false } func (insn Insn) isLabel() bool { return false } type Keyword struct { name string args string } func (kw Keyword) isInsn() bool { return false } func (kw Keyword) isKeyword() bool { return true } func (kw Keyword) isLabel() bool { return false } type Label struct { name string } func (l Label) isInsn() bool { return false } func (l Label) isKeyword() bool { return true } func (l Label) isLabel() bool { return false } // Hand-written parser func EatWhitespace(input string) (string, int) { var eaten int = 0 for len(input) > 0 { if input[0] != ' ' { return input, eaten } input++ eaten++ } return input, eaten } ------------ $ go build # gitlab.linki.tools/go-devtools/asmparser go1: internal compiler error: in set_type, at go/gofrontend/expressions.cc:16320 0x6013af Numeric_constant::set_type(Type*, bool, Location) ../../../gcc/gcc/go/gofrontend/expressions.cc:16320 0x8c06f9 Integer_expression::do_check_types(Gogo*) ../../../gcc/gcc/go/gofrontend/expressions.cc:2003 0x8dde63 Expression::check_types(Gogo*) ../../../gcc/gcc/go/gofrontend/expressions.h:902 0x8dde63 Check_types_traverse::expression(Expression**) ../../../gcc/gcc/go/gofrontend/gogo.cc:3297 0x8b190d Expression::traverse(Expression**, Traverse*) ../../../gcc/gcc/go/gofrontend/expressions.cc:45 0x8bb538 Expression_list::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/expressions.cc:15857 0x8e05b1 Block::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:5977 0x8e05b1 Block::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:5977 0x8e05b1 Block::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:5977 0x8e05b1 Block::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:5977 0x8e07c9 Function::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:5101 0x8e3ebb Bindings::traverse(Traverse*, bool) ../../../gcc/gcc/go/gofrontend/gogo.cc:7803 0x8e41d1 Gogo::traverse(Traverse*) ../../../gcc/gcc/go/gofrontend/gogo.cc:2497 0x8e44e6 Gogo::check_types() ../../../gcc/gcc/go/gofrontend/gogo.cc:3307 0x8dd76f go_parse_input_files(char const**, unsigned int, bool, bool) ../../../gcc/gcc/go/gofrontend/go.cc:133 0x8d8bcf go_langhook_parse_file ../../../gcc/gcc/go/go-lang.c:323 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Fails wth both gccgo 7.2.1 (distributed with Fedora) and $ go version go version go1.9 gccgo (GCC) 8.0.0 20171120 (experimental) linux/amd64 which I just built locally.