https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Bug ID: 98899
Summary: ICE: Illegal instruction: 4 "error: could not convert
'<unparsed>' from ''<invalid tree code>'" on macOS
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: akim.demaille at gmail dot com
Target Milestone: ---
G++ behaves randomly on this issue. Sometimes it gives me an error message
that does not seem to be meant for the user:
```
$ g++-mp-10 simple.cc -Wall -c
simple.cc: In instantiation of
'yy::parser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, int&&)
[with Base = yy::parser::by_kind; typename Base::kind_type =
yy::parser::token::token_kind_type]':
simple.cc:653:53: required from here
simple.cc:484:7: error: could not convert '<unparsed>' from ''<invalid tree
code>' not supported by dump_type<type error>' to 'bool'
484 | basic_symbol (typename Base::kind_type t, int&& v)
| ^~~~~~~~~~~~
simple.cc: In instantiation of
'yy::parser::basic_symbol<Base>::basic_symbol(typename Base::kind_type,
std::string&&) [with Base = yy::parser::by_kind; typename Base::kind_type =
yy::parser::token::token_kind_type; std::string =
std::__cxx11::basic_string<char>]':
simple.cc:661:53: required from here
simple.cc:497:7: error: could not convert '<unparsed>' from ''<invalid tree
code>' not supported by dump_type<type error>' to 'bool'
497 | basic_symbol (typename Base::kind_type t, std::string&& v)
| ^~~~~~~~~~~~
simple.cc: In instantiation of
'yy::parser::basic_symbol<Base>::basic_symbol(yy::parser::basic_symbol<Base>&&)
[with Base = yy::parser::by_kind]':
simple.cc:722:41: required from here
simple.cc:438:7: error: could not convert '<unparsed>' from ''<invalid tree
code>' not supported by dump_type<type error>' to 'bool'
438 | basic_symbol (basic_symbol&& that)
| ^~~~~~~~~~~~
```
and sometimes it crashes:
```
$ g++-mp-10 simple.cc -Wall -c
simple.cc: In instantiation of
'yy::parser::basic_symbol<Base>::basic_symbol(typename Base::kind_type, int&&)
[with Base = yy::parser::by_kind; typename Base::kind_type =
yy::parser::token::token_kind_type]':
simple.cc:653:53: required from here
simple.cc:484:7: internal compiler error: Illegal instruction: 4
484 | basic_symbol (typename Base::kind_type t, int&& v)
| ^~~~~~~~~~~~
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
```
I have tried to reduce the example, but it seems to be quite touchy.
This is:
```
$ g++-mp-10 --version
g++-mp-10 (MacPorts gcc10 10.2.0_4) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
FWIW, clang++ 11 accepts this source.
(I have problems trying to add the attachment, will try when the issue is
created.)