Bug 85215 - [8 Regression] ICE: "gcc_assert (!force_elide);" failure
Summary: [8 Regression] ICE: "gcc_assert (!force_elide);" failure
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-04-04 23:27 UTC by David Malcolm
Modified: 2018-04-05 04:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-04-05 00:00:00


Attachments
Reproducer (228 bytes, text/plain)
2018-04-04 23:27 UTC, David Malcolm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Malcolm 2018-04-04 23:27:04 UTC
Created attachment 43847 [details]
Reproducer

The downstream bug report:
  https://bugzilla.redhat.com/show_bug.cgi?id=1562194
describes an ICE due to this assertion failing:

8243	  gcc_assert (!force_elide);

I'm attaching a minimized reproducer, which ICEs on current trunk (r259106), with -std=c++1z.

$ ./xg++ -B. -c /tmp/rhbz1562194.cc -std=c++1z 
/tmp/rhbz1562194.cc: In constructor ‘buffer_info::buffer_info(any_container<int>)’:
/tmp/rhbz1562194.cc:17:66: internal compiler error: in build_over_call, at cp/call.c:8243
   buffer_info(any_container<int> shape_in) : shape(move(shape_in)) {}
                                                                  ^
0x823faa build_over_call
	../../src/gcc/cp/call.c:8243
0x8298e3 build_new_method_call_1
	../../src/gcc/cp/call.c:9366
0x829f29 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int)
	../../src/gcc/cp/call.c:9441
0x826f1b build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int)
	../../src/gcc/cp/call.c:8969
0x954e20 expand_default_init
	../../src/gcc/cp/init.c:1887
0x9554a3 expand_aggr_init_1
	../../src/gcc/cp/init.c:2002
0x954053 build_aggr_init(tree_node*, tree_node*, int, int)
	../../src/gcc/cp/init.c:1742
0x950227 perform_member_init
	../../src/gcc/cp/init.c:847
0x9527d3 emit_mem_initializers(tree_node*)
	../../src/gcc/cp/init.c:1293
0xad0a7c finish_mem_initializers(tree_node*)
	../../src/gcc/cp/semantics.c:1704
0x9e03b5 cp_parser_mem_initializer_list
	../../src/gcc/cp/parser.c:14440
0x9dfc74 cp_parser_ctor_initializer_opt
	../../src/gcc/cp/parser.c:14353
0x9eeb48 cp_parser_ctor_initializer_opt_and_function_body
	../../src/gcc/cp/parser.c:21803
0x9f9053 cp_parser_function_definition_after_declarator
	../../src/gcc/cp/parser.c:26839
0x9fb8dc cp_parser_late_parsing_for_member
	../../src/gcc/cp/parser.c:27719
0x9f141a cp_parser_class_specifier_1
	../../src/gcc/cp/parser.c:22757
0x9f14f7 cp_parser_class_specifier
	../../src/gcc/cp/parser.c:22783
0x9e43a8 cp_parser_type_specifier
	../../src/gcc/cp/parser.c:16766
0x9de948 cp_parser_decl_specifier_seq
	../../src/gcc/cp/parser.c:13617
0x9dd071 cp_parser_simple_declaration
	../../src/gcc/cp/parser.c:12927
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.
Comment 1 David Malcolm 2018-04-04 23:43:37 UTC
Started somewhere between r258751 (unaffected) and r258755 (affected)
Comment 2 David Malcolm 2018-04-04 23:46:40 UTC
(In reply to David Malcolm from comment #1)
> Started somewhere between r258751 (unaffected) and r258755 (affected)

Probably started at r258755 (fix for PR c++/81311)
Comment 3 Paolo Carlini 2018-04-04 23:54:19 UTC
I don't think this is just an ICE on invalid: we can trivially fix the snippet as:

template <typename _Tp> struct remove_reference {};
template <typename _Tp> struct remove_reference<_Tp &> {
  typedef _Tp type;
};
template <typename _Tp>
constexpr typename remove_reference<_Tp>::type &&move(_Tp &&__t) noexcept { return static_cast<typename remove_reference<_Tp>::type&&>(__t);
}
template <typename _Tp> struct vector {
  vector(vector &&) noexcept {}
};
template <typename T> struct any_container {
  vector<T> v;
  operator vector<T> &&() && { return move(v); }
};
struct buffer_info {
  vector<int> shape;
  buffer_info(any_container<int> shape_in) : shape(move(shape_in)) {}
};
Comment 4 Jason Merrill 2018-04-05 04:01:33 UTC
Fixed.
Comment 5 Jason Merrill 2018-04-05 04:01:47 UTC
Author: jason
Date: Thu Apr  5 04:01:15 2018
New Revision: 259123

URL: https://gcc.gnu.org/viewcvs?rev=259123&root=gcc&view=rev
Log:
	PR c++/85215 - ICE with copy-init from conversion.

	* call.c (merge_conversion_sequences): Fix type of direct binding
	sequence.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1z/elide3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c