Bug 84836 - [8 Regression] ICE in pop_local_binding, at cp/name-lookup.c:2054
Summary: [8 Regression] ICE in pop_local_binding, at cp/name-lookup.c:2054
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Nathan Sidwell
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-03-12 17:53 UTC by G. Steinmetz
Modified: 2018-03-21 10:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2018-03-12 17:53:23 UTC
Changed before 20170618, gcc-7 compiles :


$ cat z1.cc
void foo (void)
{
  struct A;
  void A (int);
  void A (long);
}


$ gcc-7 -c z1.cc
$
$ gcc-8-20180311 -c z1.cc
z1.cc: In function 'void foo()':
z1.cc:5:16: internal compiler error: in pop_local_binding, at cp/name-lookup.c:2054
   void A (long);
                ^
0x714919 pop_local_binding(tree_node*, tree_node*)
        ../../gcc/cp/name-lookup.c:2054
0x6d7189 poplevel(int, int, int)
        ../../gcc/cp/decl.c:776
0x791d53 do_poplevel(tree_node*)
        ../../gcc/cp/semantics.c:451
0x792b2c finish_compound_stmt(tree_node*)
        ../../gcc/cp/semantics.c:1451
0x738887 cp_parser_compound_statement
        ../../gcc/cp/parser.c:11230
0x74a37e cp_parser_function_body
        ../../gcc/cp/parser.c:21778
0x74a37e cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:21813
0x74ab40 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:26828
0x74dce6 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:26745
0x74dce6 cp_parser_init_declarator
        ../../gcc/cp/parser.c:19502
0x74ee0f cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13057
0x74fba8 cp_parser_block_declaration
        ../../gcc/cp/parser.c:12883
0x7577ee cp_parser_declaration
        ../../gcc/cp/parser.c:12780
0x756356 cp_parser_declaration_seq_opt
        ../../gcc/cp/parser.c:12656
0x75665f cp_parser_translation_unit
        ../../gcc/cp/parser.c:4561
0x75665f c_parse_file()
        ../../gcc/cp/parser.c:39005
0x80ce65 c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1132
Comment 1 David Malcolm 2018-03-12 20:07:05 UTC
Confirmed.  Started with r248687.

2054	      gcc_assert (binding->type == decl);

(gdb) p ((struct lang_identifier*)id)->bindings->type
$8 = <tree 0x0>
Comment 2 Nathan Sidwell 2018-03-21 10:59:58 UTC
Fixed r258711.
Comment 3 Nathan Sidwell 2018-03-21 10:59:59 UTC
Author: nathan
Date: Wed Mar 21 10:59:28 2018
New Revision: 258711

URL: https://gcc.gnu.org/viewcvs?rev=258711&root=gcc&view=rev
Log:
[PR c++/84836] ICE with local scopes

https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01082.html
	PR c++/84836
	* name-lookup.c (update_binding): Correct logic for local binding
	update.

	PR c++/84836
	* g++.dg/lookup/pr84836.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/lookup/pr84836.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog