public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS
@ 2021-01-31 6:17 akim.demaille at gmail dot com
2021-01-31 6:20 ` [Bug c++/98899] " akim.demaille at gmail dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: akim.demaille at gmail dot com @ 2021-01-31 6:17 UTC (permalink / raw)
To: gcc-bugs
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.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
@ 2021-01-31 6:20 ` akim.demaille at gmail dot com
2021-01-31 6:21 ` akim.demaille at gmail dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: akim.demaille at gmail dot com @ 2021-01-31 6:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
--- Comment #1 from Akim Demaille <akim.demaille at gmail dot com> ---
Created attachment 50093
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50093&action=edit
simple.cc
The source that causes the crash.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
2021-01-31 6:20 ` [Bug c++/98899] " akim.demaille at gmail dot com
@ 2021-01-31 6:21 ` akim.demaille at gmail dot com
2021-02-01 8:53 ` [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c marxin at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: akim.demaille at gmail dot com @ 2021-01-31 6:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
--- Comment #2 from Akim Demaille <akim.demaille at gmail dot com> ---
Created attachment 50094
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50094&action=edit
simple.ii
simple.cc preprocessed
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
2021-01-31 6:20 ` [Bug c++/98899] " akim.demaille at gmail dot com
2021-01-31 6:21 ` akim.demaille at gmail dot com
@ 2021-02-01 8:53 ` marxin at gcc dot gnu.org
2021-02-01 13:15 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-01 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.3
Status|UNCONFIRMED |NEW
Summary|ICE: Illegal instruction: 4 |[10/11 Regression] ICE in
|"error: could not convert |tsubst_copy, at
|'<unparsed>' from |cp/pt.c:16198 since
|''<invalid tree code>'" on |r10-1280-g78f7607db4c53f8c
|macOS |
CC| |marxin at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2021-02-01
Keywords| |ice-on-valid-code
Ever confirmed|0 |1
Known to work| |9.3.0
Known to fail| |10.2.0, 11.0
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you for the bug report.
Reduce test-case:
$ cat pr98899.ii
template <int __v> struct integral_constant {
static constexpr int value = __v;
};
template <typename> struct conditional;
template <typename...> struct __and_;
template <typename _B1, typename _B2>
struct __and_<_B1, _B2> : conditional<_B1>::type {};
template <typename...>
struct __is_nt_constructible_impl : integral_constant<0> {};
template <typename... _Args>
struct is_nothrow_constructible
: __and_<int, __is_nt_constructible_impl<_Args...>> {};
template <typename> struct conditional {
typedef __is_nt_constructible_impl<> type;
};
class locale {
struct token {
enum {} typedef yytokentype;
};
template <typename Base> struct basic_symbol {
basic_symbol(typename Base::kind_type,
int) noexcept(is_nothrow_constructible<>::value);
};
struct by_kind {
typedef token::yytokentype kind_type;
};
struct symbol_type : basic_symbol<by_kind> {
int symbol_type_v;
symbol_type() : basic_symbol(token::yytokentype(), symbol_type_v) {}
};
};
$ g++ pr98899.ii -c -Werror
pr98899.ii: In instantiation of
‘locale::basic_symbol<Base>::basic_symbol(typename Base::kind_type, int) [with
Base = locale::by_kind; typename Base::kind_type =
locale::token::yytokentype]’:
pr98899.ii:29:69: required from here
pr98899.ii:21:5: internal compiler error: in tsubst_copy, at cp/pt.c:17205
21 | basic_symbol(typename Base::kind_type,
| ^~~~~~~~~~~~
0x6e0e47 tsubst_copy
/home/marxin/Programming/gcc/gcc/cp/pt.c:17205
0xb24f7e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:20789
0xb28755 maybe_instantiate_noexcept(tree_node*, int)
/home/marxin/Programming/gcc/gcc/cp/pt.c:25592
0xb2833c maybe_instantiate_noexcept(tree_node*, int)
/home/marxin/Programming/gcc/gcc/cp/pt.c:25535
0xa194ca mark_used(tree_node*, int)
/home/marxin/Programming/gcc/gcc/cp/decl2.c:5610
0x9623a5 build_over_call
/home/marxin/Programming/gcc/gcc/cp/call.c:9351
0x95f722 build_new_method_call_1
/home/marxin/Programming/gcc/gcc/cp/call.c:10637
0x95f722 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
/home/marxin/Programming/gcc/gcc/cp/call.c:10712
0x960a86 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
/home/marxin/Programming/gcc/gcc/cp/call.c:10113
0xa385ca expand_default_init
/home/marxin/Programming/gcc/gcc/cp/init.c:1983
0xa385ca expand_aggr_init_1
/home/marxin/Programming/gcc/gcc/cp/init.c:2098
0xa3fb1b emit_mem_initializers(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/init.c:1354
0xaf39b9 cp_parser_mem_initializer_list
/home/marxin/Programming/gcc/gcc/cp/parser.c:15907
0xaf39b9 cp_parser_ctor_initializer_opt
/home/marxin/Programming/gcc/gcc/cp/parser.c:15815
0xaf39b9 cp_parser_ctor_initializer_opt_and_function_body
/home/marxin/Programming/gcc/gcc/cp/parser.c:24027
0xaf511a cp_parser_function_definition_after_declarator
/home/marxin/Programming/gcc/gcc/cp/parser.c:29938
0xaf5624 cp_parser_late_parsing_for_member
/home/marxin/Programming/gcc/gcc/cp/parser.c:30845
0xacea63 cp_parser_class_specifier_1
/home/marxin/Programming/gcc/gcc/cp/parser.c:25104
0xacfa7b cp_parser_class_specifier
/home/marxin/Programming/gcc/gcc/cp/parser.c:25128
0xacfa7b cp_parser_type_specifier
/home/marxin/Programming/gcc/gcc/cp/parser.c:18381
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (2 preceding siblings ...)
2021-02-01 8:53 ` [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c marxin at gcc dot gnu.org
@ 2021-02-01 13:15 ` ppalka at gcc dot gnu.org
2021-02-01 13:28 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-01 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW, here's a more minimal testcase:
template <int __v> struct integral_constant {
static constexpr int value = __v;
};
struct _Bit_iterator_base {
template <class> struct basic_symbol {
basic_symbol() noexcept(integral_constant<false>::value);
};
struct symbol_type : basic_symbol<int> {
symbol_type() : basic_symbol() {}
};
};
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (3 preceding siblings ...)
2021-02-01 13:15 ` ppalka at gcc dot gnu.org
@ 2021-02-01 13:28 ` mpolacek at gcc dot gnu.org
2021-02-03 15:17 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-02-01 13:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (4 preceding siblings ...)
2021-02-01 13:28 ` mpolacek at gcc dot gnu.org
@ 2021-02-03 15:17 ` cvs-commit at gcc dot gnu.org
2021-02-03 15:22 ` [Bug c++/98899] [10 " mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-03 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:25fdd0d6df44044a8b505e6fcd07270e2e279b06
commit r11-7065-g25fdd0d6df44044a8b505e6fcd07270e2e279b06
Author: Marek Polacek <polacek@redhat.com>
Date: Mon Feb 1 23:30:05 2021 -0500
c++: ICE with late parsing of noexcept in nested class [PR98899]
Here we crash with a noexcept-specifier in a nested template class,
because my handling of such deferred-parse noexcept-specifiers was
gronked when we need to instantiate a DEFERRED_PARSE before it was
actually parsed at the end of the outermost class.
In
struct S {
template<class> struct B {
B() noexcept(noexcept(x));
int x;
};
struct A : B<int> {
A() : B() {}
};
};
we call complete_type for B<int> which triggers tsubsting S::B<int>::B()
whose noexcept-specifier still contains a DEFERRED_PARSE. The trick is
to stash such noexcept-specifiers into DEFPARSE_INSTANTIATIONS so that
we can replace it later when we've finally parsed all deferred
noexcept-specifiers.
In passing, fix missing usage of UNPARSED_NOEXCEPT_SPEC_P.
gcc/cp/ChangeLog:
PR c++/98899
* parser.c (cp_parser_class_specifier_1): Use any possible
DEFPARSE_INSTANTIATIONS to update DEFERRED_NOEXCEPT_PATTERN.
(cp_parser_save_noexcept): Initialize DEFPARSE_INSTANTIATIONS.
* pt.c (tsubst_exception_specification): Stash new_specs into
DEFPARSE_INSTANTIATIONS.
* tree.c (fixup_deferred_exception_variants): Use
UNPARSED_NOEXCEPT_SPEC_P.
gcc/testsuite/ChangeLog:
PR c++/98899
* g++.dg/cpp0x/noexcept65.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (5 preceding siblings ...)
2021-02-03 15:17 ` cvs-commit at gcc dot gnu.org
@ 2021-02-03 15:22 ` mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-09 22:57 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-02-03 15:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11 Regression] ICE in |[10 Regression] ICE in
|tsubst_copy, at |tsubst_copy, at
|cp/pt.c:16198 since |cp/pt.c:16198 since
|r10-1280-g78f7607db4c53f8c |r10-1280-g78f7607db4c53f8c
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (6 preceding siblings ...)
2021-02-03 15:22 ` [Bug c++/98899] [10 " mpolacek at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-09 22:57 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.3 |10.4
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98899] [10 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
` (7 preceding siblings ...)
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-04-09 22:57 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98899
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Not backporting to GCC 10.4 since it depends on another patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-04-09 22:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31 6:17 [Bug c++/98899] New: ICE: Illegal instruction: 4 "error: could not convert '<unparsed>' from ''<invalid tree code>'" on macOS akim.demaille at gmail dot com
2021-01-31 6:20 ` [Bug c++/98899] " akim.demaille at gmail dot com
2021-01-31 6:21 ` akim.demaille at gmail dot com
2021-02-01 8:53 ` [Bug c++/98899] [10/11 Regression] ICE in tsubst_copy, at cp/pt.c:16198 since r10-1280-g78f7607db4c53f8c marxin at gcc dot gnu.org
2021-02-01 13:15 ` ppalka at gcc dot gnu.org
2021-02-01 13:28 ` mpolacek at gcc dot gnu.org
2021-02-03 15:17 ` cvs-commit at gcc dot gnu.org
2021-02-03 15:22 ` [Bug c++/98899] [10 " mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-09 22:57 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).