public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers
@ 2021-04-09 16:40 mpolacek at gcc dot gnu.org
  2021-04-09 16:40 ` [Bug c++/100003] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 16:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100003

            Bug ID: 100003
           Summary: internal compiler error: in merge_exception_specifiers
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The directive here is important:

# 9 "" 3
template <typename T> struct S {
  bool foo();
  S() noexcept(foo());
};
template<typename T> S<T>::S() noexcept(T::value) {}

$ ./cc1plus -quiet q.C
:13:49: internal compiler error: in merge_exception_specifiers, at
cp/typeck2.c:2420
0xe1e274 merge_exception_specifiers(tree_node*, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/typeck2.c:2420
0xdef11c merge_types(tree_node*, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/typeck.c:890
0xb14e18 duplicate_decls(tree_node*, tree_node*, bool, bool)
        /home/mpolacek/src/gcc/gcc/cp/decl.c:2339
0xb3a380 grokfndecl
        /home/mpolacek/src/gcc/gcc/cp/decl.c:10143
0xb468b3 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/mpolacek/src/gcc/gcc/cp/decl.c:13903
0xb54ba2 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/decl.c:16838
0xcb0635 cp_parser_function_definition_from_specifiers_and_declarator
        /home/mpolacek/src/gcc/gcc/cp/parser.c:29904
0xc9f847 cp_parser_init_declarator
        /home/mpolacek/src/gcc/gcc/cp/parser.c:21634
0xcb1f58 cp_parser_single_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.c:30528
0xcb0bdd cp_parser_template_declaration_after_parameters
        /home/mpolacek/src/gcc/gcc/cp/parser.c:30100
0xcb1b51 cp_parser_explicit_template_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.c:30366
0xcb1bab cp_parser_template_declaration_after_export
        /home/mpolacek/src/gcc/gcc/cp/parser.c:30385
0xc95af6 cp_parser_template_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.c:16594
0xc913c4 cp_parser_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.c:14070
0xc917d7 cp_parser_toplevel_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.c:14168
0xc7d11f cp_parser_translation_unit
        /home/mpolacek/src/gcc/gcc/cp/parser.c:4942
0xce022a c_parse_file()
        /home/mpolacek/src/gcc/gcc/cp/parser.c:45268
0xea2d8e c_common_parse_file()
        /home/mpolacek/src/gcc/gcc/c-family/c-opts.c:1218

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/100003] internal compiler error: in merge_exception_specifiers
  2021-04-09 16:40 [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers mpolacek at gcc dot gnu.org
@ 2021-04-09 16:40 ` mpolacek at gcc dot gnu.org
  2021-04-09 17:14 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 16:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100003

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Without the directive:

q.C:6:22: error: declaration of ‘S<T>::S() noexcept (T::value)’ has a different
exception specifier
    6 | template<typename T> S<T>::S() noexcept(T::value) {}
      |                      ^~~~
q.C:4:3: note: from previous declaration ‘S<T>::S() noexcept
(((S<T>*)this)->S<T>::foo())’
    4 |   S() noexcept(foo());
      |   ^

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/100003] internal compiler error: in merge_exception_specifiers
  2021-04-09 16:40 [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers mpolacek at gcc dot gnu.org
  2021-04-09 16:40 ` [Bug c++/100003] " mpolacek at gcc dot gnu.org
@ 2021-04-09 17:14 ` mpolacek at gcc dot gnu.org
  2021-04-09 17:32 ` mpolacek at gcc dot gnu.org
  2021-08-09 19:11 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 17:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100003

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r160297 or r160298 I think.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/100003] internal compiler error: in merge_exception_specifiers
  2021-04-09 16:40 [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers mpolacek at gcc dot gnu.org
  2021-04-09 16:40 ` [Bug c++/100003] " mpolacek at gcc dot gnu.org
  2021-04-09 17:14 ` mpolacek at gcc dot gnu.org
@ 2021-04-09 17:32 ` mpolacek at gcc dot gnu.org
  2021-08-09 19:11 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-09 17:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100003

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem is that, when we're in a system header,
check_redeclaration_exception_specification doesn't emit an error:

 1242       if (DECL_IN_SYSTEM_HEADER (old_decl))
 1243         complained = pedwarn (new_loc, OPT_Wsystem_headers, msg,
new_decl);

so then we crash here:

2420   gcc_checking_assert (!TREE_PURPOSE (add)
2421                        || errorcount || !flag_exceptions
2422                        || cp_tree_equal (noex, TREE_PURPOSE (add)));

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/100003] internal compiler error: in merge_exception_specifiers
  2021-04-09 16:40 [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-04-09 17:32 ` mpolacek at gcc dot gnu.org
@ 2021-08-09 19:11 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 19:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100003

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-09
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-09 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 16:40 [Bug c++/100003] New: internal compiler error: in merge_exception_specifiers mpolacek at gcc dot gnu.org
2021-04-09 16:40 ` [Bug c++/100003] " mpolacek at gcc dot gnu.org
2021-04-09 17:14 ` mpolacek at gcc dot gnu.org
2021-04-09 17:32 ` mpolacek at gcc dot gnu.org
2021-08-09 19:11 ` pinskia 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).