Bug 68722 - [4.9/5 Regression] internal compiler error: in merge_exception_specifiers, at cp/typeck2.c:2108
Summary: [4.9/5 Regression] internal compiler error: in merge_exception_specifiers, at...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P4 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2015-12-05 17:42 UTC by John Regehr
Modified: 2016-05-04 22:15 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-03-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2015-12-05 17:42:49 UTC
Possibly a dup of PR68475

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r231259-install/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/regehr/z/compiler-source/gcc/configure --prefix=/home/regehr/z/compiler-install/gcc-r231259-install --disable-bootstrap --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 6.0.0 20151204 (experimental) (GCC) 


$ cat hello.cpp
class A {
  &__loc
} class ios_base {
  A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios {
basic_ios basic_ios = operator=


$ g++ -std=c++11 hello.cpp -w
hello.cpp:2:4: error: ISO C++ forbids declaration of ‘__loc’ with no type [-fpermissive]
   &__loc
    ^~~~~

hello.cpp:2:4: error: expected ‘;’ at end of member declaration
hello.cpp:3:1: error: expected ‘;’ after class definition
 } class ios_base {
 ^

hello.cpp:4:5: error: expected ‘;’ at end of member declaration
   A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios {
     ^~~~~~~~~~~~~

hello.cpp:4:38: error: expected ‘;’ at end of member declaration
   A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios {
                                      ^

hello.cpp:4:50: error: ‘_Traits’ has not been declared
   A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios {
                                                  ^~~~~~~

cc1plus: error: file ends in default argument
hello.cpp:5:31: error: expected ‘;’ at end of member declaration
 basic_ios basic_ios = operator=
                               ^

hello.cpp:5:31: error: expected ‘}’ at end of input
hello.cpp:5:31: error: expected unqualified-id at end of input
hello.cpp:5:31: error: expected ‘}’ at end of input
hello.cpp:5:31: error: use of deleted function ‘ios_base& ios_base::operator=(const ios_base&)’
hello.cpp:3:9: internal compiler error: in merge_exception_specifiers, at cp/typeck2.c:2108
 } class ios_base {
         ^~~~~~~~

0x667dd1 merge_exception_specifiers(tree_node*, tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/typeck2.c:2108
0x741306 process_subob_fn
	/home/regehr/z/compiler-source/gcc/gcc/cp/method.c:1109
0x74353a walk_field_subobs
	/home/regehr/z/compiler-source/gcc/gcc/cp/method.c:1288
0x744042 synthesized_method_walk
	/home/regehr/z/compiler-source/gcc/gcc/cp/method.c:1527
0x748ef4 maybe_explain_implicit_delete(tree_node*)
	/home/regehr/z/compiler-source/gcc/gcc/cp/method.c:1627
0x69ef80 mark_used(tree_node*, int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/decl2.c:5087
0x764a0c finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
	/home/regehr/z/compiler-source/gcc/gcc/cp/semantics.c:3636
0x6cf689 cp_parser_primary_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:5068
0x6d0f79 cp_parser_postfix_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:6447
0x6daf08 cp_parser_unary_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:7688
0x6dbc58 cp_parser_binary_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:8442
0x6dc51f cp_parser_assignment_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:8712
0x6dc983 cp_parser_constant_expression
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:8964
0x6df1a6 cp_parser_late_parse_one_default_arg
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:25705
0x6c611d cp_parser_late_parsing_nsdmi
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:25755
0x6c611d cp_parser_class_specifier_1
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21028
0x6c85d9 cp_parser_class_specifier
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21081
0x6c85d9 cp_parser_type_specifier
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:15391
0x6e568b cp_parser_decl_specifier_seq
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:12343
0x6f1221 cp_parser_simple_declaration
	/home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11909
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
regehr@hawking:~/svn/code/reduce/creduce_extra_698/reduce$
Comment 1 Jakub Jelinek 2016-03-14 08:46:10 UTC
Started with r204818.
Comment 2 Paolo Carlini 2016-03-14 18:57:46 UTC
I wonder if in such cases, where we run out of tokens and we issue:

   error_at (token->location, "file ends in default argument");

from cp_parser_cache_defarg we should instead use something like a fatal_error and stop the meaningless chain of redundant errors. Certainly that avoids the error recovery ICE at issue and passes testing...
Comment 3 Paolo Carlini 2016-04-08 21:21:12 UTC
Looking into it.
Comment 4 paolo@gcc.gnu.org 2016-04-12 17:55:06 UTC
Author: paolo
Date: Tue Apr 12 17:54:34 2016
New Revision: 234909

URL: https://gcc.gnu.org/viewcvs?rev=234909&root=gcc&view=rev
Log:
/cp
2016-04-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68722
	* parser.c (cp_parser_cache_defarg): When file ends in default
	argument simply return error_mark_node.

/testsuite
2016-04-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68722
	* g++.dg/parse/pr68722.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/parse/pr68722.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2016-04-12 17:56:25 UTC
Fixed in trunk so far.
Comment 6 Paolo Carlini 2016-05-04 22:15:08 UTC
Not going to backport the fix to gcc-4_9-branch and gcc-5-branch.