[Bug c++/101903] New: [9/10/11/12 Regression] ICE with invalid constexpr constructor in template class

2021-08-13 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101903

Bug ID: 101903
   Summary: [9/10/11/12 Regression] ICE with invalid constexpr
constructor in template class
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: error-recovery, ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 7.1.0:

===
template struct A
{
  int i{};

  A();
  constexpr A(int) : A() {}
};

constexpr A<0> a{0};
===

bug.cc:9:19: error: 'constexpr A< >::A(int) [with int  =
0]' called in a constant expression
9 | constexpr A<0> a{0};
  |   ^
bug.cc:6:13: note: 'constexpr A< >::A(int) [with int  =
0]' is not usable as a 'constexpr' function because:
6 |   constexpr A(int) : A() {}
  | ^
bug.cc:6:13: internal compiler error: in build_data_member_initialization, at
cp/constexpr.c:400
0x66cf30 build_data_member_initialization
../../gcc/gcc/cp/constexpr.c:400
0x960432 build_constexpr_constructor_member_initializers
../../gcc/gcc/cp/constexpr.c:612
0x960432 massage_constexpr_body
../../gcc/gcc/cp/constexpr.c:738
0x96ce3d explain_invalid_constexpr_fn(tree_node*)
../../gcc/gcc/cp/constexpr.c:982
0x9621e1 cxx_eval_call_expression
../../gcc/gcc/cp/constexpr.c:2594
0x96543c cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:6269
0x968cc4 cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/constexpr.c:7301
0x96da7e maybe_constant_init_1
../../gcc/gcc/cp/constexpr.c:7756
0xb9902a store_init_value(tree_node*, tree_node*, vec**, int)
../../gcc/gcc/cp/typeck2.c:777
0x9b4cc6 check_initializer
../../gcc/gcc/cp/decl.c:7185
0x9dab09 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/gcc/cp/decl.c:8119
0xac5174 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:22556
0xaa0773 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:15088
0xacfdb5 cp_parser_declaration
../../gcc/gcc/cp/parser.c:14787
0xad078e cp_parser_toplevel_declaration
../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4978
0xad078e c_parse_file()
../../gcc/gcc/cp/parser.c:46558
0xbf924d c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1223
Please submit a full bug report, [etc.]

[Bug c++/101880] mangling vec_perm_expr is not implemented

2021-08-13 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101880

Volker Reichelt  changed:

   What|Removed |Added

 CC||reichelt at gcc dot gnu.org
 Ever confirmed|0   |1
   Keywords||rejects-valid
  Known to fail||12.0, 4.9.0, 9.1.0
   Last reconfirmed||2021-08-13
 Status|UNCONFIRMED |NEW

[Bug c++/101898] New: [concepts] ICE with auto in concept definition

2021-08-13 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101898

Bug ID: 101898
   Summary: [concepts] ICE with auto in concept definition
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-fconcepts")
triggers an ICE since GCC 6.1.0 (when concepts were introduced):


template concept bool C
  = requires(int i, void(f)(auto)) { true; };


bug.cc:2:45: internal compiler error: in pop_local_binding, at
cp/name-lookup.c:2496
2 |   = requires(int i, void(f)(auto)) { true; };
  | ^
0x6c5612 pop_local_binding(tree_node*, tree_node*)
../../gcc/gcc/cp/name-lookup.c:2496
0x6c5612 pop_local_binding(tree_node*, tree_node*)
../../gcc/gcc/cp/name-lookup.c:2484
0x9d6279 poplevel(int, int, int)
../../gcc/gcc/cp/decl.c:731
0xadc2a8 end_template_decl()
../../gcc/gcc/cp/pt.c:4738
0xaccc23 cp_parser_template_declaration_after_parameters
../../gcc/gcc/cp/parser.c:30992
0xacd2a0 cp_parser_explicit_template_declaration
../../gcc/gcc/cp/parser.c:31232
0xacfd69 cp_parser_declaration
../../gcc/gcc/cp/parser.c:14718
0xad078e cp_parser_toplevel_declaration
../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4978
0xad078e c_parse_file()
../../gcc/gcc/cp/parser.c:46558
0xbf924d c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1223
Please submit a full bug report, [etc.]

[Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101894

--- Comment #3 from Volker Reichelt  ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Volker Reichelt from comment #1)
> > Actually the same ICE happens with regular templates (without the
> > "-fconcepts") flag:
> 
> Though that is only on the trunk while the auto one is on the 11 branch too.

Both testcases trigger the ICE for me on the 11 branch (and trunk).

[Bug c++/101894] [11/12 Regression] ICE with multiple friend declarations

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101894

Volker Reichelt  changed:

   What|Removed |Added

Summary|[11/12 Regression]  |[11/12 Regression] ICE with
   |[concepts] ICE with |multiple friend
   |multiple friend |declarations
   |declarations|

--- Comment #1 from Volker Reichelt  ---
Actually the same ICE happens with regular templates (without the "-fconcepts")
flag:

=
struct A
{
  template friend void foo();
  template friend void foo() {}
};
=

[Bug c++/101894] New: [11/12 Regression] [concepts] ICE with multiple friend declarations

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101894

Bug ID: 101894
   Summary: [11/12 Regression] [concepts] ICE with multiple friend
declarations
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-fconcepts")
triggers an ICE since GCC 11:

=
struct A
{
  friend void foo(auto);
  friend void foo(auto) {}
};
=

bug.cc:4:25: internal compiler error: in push_template_decl, at cp/pt.c:5714
4 |   friend void foo(auto) {}
  | ^
0x6fe076 push_template_decl(tree_node*, bool)
../../gcc/gcc/cp/pt.c:5714
0x9ba6f4 start_preparsed_function(tree_node*, tree_node*, int)
../../gcc/gcc/cp/decl.c:16635
0xac45f2 cp_parser_late_parsing_for_member
../../gcc/gcc/cp/parser.c:31801
0xa9d73b cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:25879
0xa9e6cf cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:25903
0xa9e6cf cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:19121
0xa9f6cc cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:15713
0xaa0644 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:14961
0xacfdb5 cp_parser_declaration
../../gcc/gcc/cp/parser.c:14787
0xad078e cp_parser_toplevel_declaration
../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4978
0xad078e c_parse_file()
../../gcc/gcc/cp/parser.c:46558
0xbf924d c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1223
Please submit a full bug report, [etc.]

[Bug c++/101889] New: [11/12 Regression] ICE with template argument deduction of broken template

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101889

Bug ID: 101889
   Summary: [11/12 Regression] ICE with template argument
deduction of broken template
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: error-recovery, ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 11:

==
template struct A {};

template struct B
{
  enum { E = 0 };
  B(A) {}
};

B b = A<0>();
==

bug.cc:3:10: error: 'T' has not been declared
3 | template struct B
  |  ^
bug.cc:9:12: internal compiler error: tree check: expected enumeral_type, have
error_mark in tsubst_copy, at cp/pt.c:16588
9 | B b = A<0>();
  |^
0x85a540 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:8686
0x6e74ea tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3373
0x6e74ea tsubst_copy
../../gcc/gcc/cp/pt.c:16588
0xaf1eb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:20870
0xafd357 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19092
0xb12264 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13355
0xb1b763 tsubst_aggr_type
../../gcc/gcc/cp/pt.c:13559
0xb1be34 tsubst_arg_types
../../gcc/gcc/cp/pt.c:14958
0xb1ed5a tsubst_arg_types
../../gcc/gcc/cp/pt.c:14935
0xb1ed5a build_deduction_guide
../../gcc/gcc/cp/pt.c:28776
0xaec0b6 ctor_deduction_guides_for
../../gcc/gcc/cp/pt.c:29184
0xaec0b6 deduction_guides_for
../../gcc/gcc/cp/pt.c:29257
0xaec576 do_class_deduction
../../gcc/gcc/cp/pt.c:29378
0xaec576 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
../../gcc/gcc/cp/pt.c:29535
0x9d9608 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/gcc/cp/decl.c:7856
0xac5174 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:22556
0xaa0773 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:15088
0xacfdb5 cp_parser_declaration
../../gcc/gcc/cp/parser.c:14787
0xad078e cp_parser_toplevel_declaration
../../gcc/gcc/cp/parser.c:14808
0xad078e cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4978
Please submit a full bug report, [etc.]

[Bug c++/101887] New: [9/10/11/12 Regression] ICE with invalid declaration of 'operator delete'

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101887

Bug ID: 101887
   Summary: [9/10/11/12 Regression] ICE with invalid declaration
of 'operator delete'
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: error-recovery, ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 4.9.0:


struct A
{
  A();
  auto operator delete(void*, __SIZE_TYPE__);
};

void foo()
{
  new A;
}


bug.cc:4:3: error: non-static data member declared with placeholder 'auto'
4 |   auto operator delete(void*, __SIZE_TYPE__);
  |   ^~~~
bug.cc: In function 'void foo()':
bug.cc:9:7: internal compiler error: tree check: expected function_type or
method_type, have error_mark in usual_deallocation_fn_p, at cp/call.c:6935
9 |   new A;
  |   ^
0x85a540 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:8686
0x6544a6 tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
../../gcc/gcc/tree.h:3392
0x6544a6 usual_deallocation_fn_p
../../gcc/gcc/cp/call.c:6935
0x9229e0 build_op_delete_call(tree_code, tree_node*, tree_node*, bool,
tree_node*, tree_node*, int)
../../gcc/gcc/cp/call.c:6926
0xa0c128 build_new_1
../../gcc/gcc/cp/init.c:3539
0xa0cf98 build_new(unsigned int, vec**,
tree_node*, tree_node*, vec**, int, int)
../../gcc/gcc/cp/init.c:3826
0xabf7d2 cp_parser_new_expression
../../gcc/gcc/cp/parser.c:9157
0xabfdff cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8745
0xa91a2a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9893
0xa9233c cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:10197
0xa938b2 cp_parser_expression
../../gcc/gcc/cp/parser.c:10367
0xa96f58 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:12531
0xaa2dff cp_parser_statement
../../gcc/gcc/cp/parser.c:12327
0xaa3e9d cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:12679
0xaa3f78 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:12628
0xac35c0 cp_parser_function_body
../../gcc/gcc/cp/parser.c:24762
0xac35c0 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:24813
0xac428a cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:30898
0xac56c4 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:30814
0xac56c4 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:22318
Please submit a full bug report, [etc.]

[Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886

Bug ID: 101886
   Summary: [11/12 Regression][concepts] ICE with auto as template
parameter
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-fconcepts")
triggers an ICE since GCC 11.1.0:


template struct A { };

A a;
A b1 = a;
A b2 = a;


bug.cc:5:13: internal compiler error: same canonical type node for different
types 'auto' and 'auto'
5 | A b2 = a;
  | ^
0xb4eb9d comptypes(tree_node*, tree_node*, int)
../../gcc-11.1.0/gcc/cp/typeck.c:1565
0xab322f template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9231
0xb42e41 cp_tree_equal(tree_node*, tree_node*)
../../gcc-11.1.0/gcc/cp/tree.c:4079
0xab305a template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9249
0xab2d88 template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9194
0xab2d88 comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**,
bool)
../../gcc-11.1.0/gcc/cp/pt.c:9278
0xab2d88 comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**,
bool)
../../gcc-11.1.0/gcc/cp/pt.c:9258
0xabc9f3 spec_hasher::equal(spec_entry*, spec_entry*)
../../gcc-11.1.0/gcc/cp/pt.c:1727
0xb02944 hash_table::find_with_hash(spec_entry* const&, unsigned int)
../../gcc-11.1.0/gcc/hash-table.h:923
0xaeef47 lookup_template_class_1
../../gcc-11.1.0/gcc/cp/pt.c:9889
0xaf0bfc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-11.1.0/gcc/cp/pt.c:10244
0xb1914b finish_template_type(tree_node*, tree_node*, int)
../../gcc-11.1.0/gcc/cp/semantics.c:3581
0xa8a8eb cp_parser_template_id
../../gcc-11.1.0/gcc/cp/parser.c:17486
0xa8aadb cp_parser_class_name
../../gcc-11.1.0/gcc/cp/parser.c:24722
0xa81fda cp_parser_qualifying_entity
../../gcc-11.1.0/gcc/cp/parser.c:7002
0xa81fda cp_parser_nested_name_specifier_opt
../../gcc-11.1.0/gcc/cp/parser.c:6684
0xaa2e18 cp_parser_template_introduction
../../gcc-11.1.0/gcc/cp/parser.c:30254
0xaa50c3 cp_parser_declaration
../../gcc-11.1.0/gcc/cp/parser.c:14149
0xaa5e4c cp_parser_toplevel_declaration
../../gcc-11.1.0/gcc/cp/parser.c:14183
0xaa5e4c cp_parser_translation_unit
../../gcc-11.1.0/gcc/cp/parser.c:4942
Please submit a full bug report, [etc.]

[Bug c++/101881] New: [9/10/11/12 Regression] ICE with vector type in template alias

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101881

Bug ID: 101881
   Summary: [9/10/11/12 Regression] ICE with vector type in
template alias
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet triggers an ICE since GCC 7.1.0:

=
template using A = int __attribute__((vector_size(N)))*; 

void foo(A<4>) {}
=

bug.cc:3:6: internal compiler error: in add_substitution, at cp/mangle.c:462
 void foo(A<4>) {}
  ^~~
0x8014a5 add_substitution
../../gcc-7.5.0/gcc/cp/mangle.c:461
0x7fa97b write_type
../../gcc-7.5.0/gcc/cp/mangle.c:2413
0x7fd114 write_method_parms
../../gcc-7.5.0/gcc/cp/mangle.c:2828
0x7fd3f6 write_bare_function_type
../../gcc-7.5.0/gcc/cp/mangle.c:2764
0x80505c mangle_decl_string
../../gcc-7.5.0/gcc/cp/mangle.c:3821
0x8053c3 get_mangled_id
../../gcc-7.5.0/gcc/cp/mangle.c:3843
0x8053c3 mangle_decl(tree_node*)
../../gcc-7.5.0/gcc/cp/mangle.c:3913
0x102833e decl_assembler_name(tree_node*)
../../gcc-7.5.0/gcc/tree.c:671
0x1077ac7 notice_global_symbol(tree_node*)
../../gcc-7.5.0/gcc/varasm.c:1656
0x96fdd9 cgraph_node::finalize_function(tree_node*, bool)
../../gcc-7.5.0/gcc/cgraphunit.c:442
0x7b5e9f expand_or_defer_fn(tree_node*)
../../gcc-7.5.0/gcc/cp/semantics.c:4321
0x74a3a9 cp_parser_function_definition_after_declarator
../../gcc-7.5.0/gcc/cp/parser.c:26468
0x74b07e cp_parser_function_definition_from_specifiers_and_declarator
../../gcc-7.5.0/gcc/cp/parser.c:26371
0x74b07e cp_parser_init_declarator
../../gcc-7.5.0/gcc/cp/parser.c:19353
0x745e3c cp_parser_simple_declaration
../../gcc-7.5.0/gcc/cp/parser.c:12886
0x746d77 cp_parser_block_declaration
../../gcc-7.5.0/gcc/cp/parser.c:12711
0x7511e4 cp_parser_declaration
../../gcc-7.5.0/gcc/cp/parser.c:12609
0x75161b cp_parser_declaration_seq_opt
../../gcc-7.5.0/gcc/cp/parser.c:12485
0x751902 cp_parser_translation_unit
../../gcc-7.5.0/gcc/cp/parser.c:4368
0x751902 c_parse_file()
../../gcc-7.5.0/gcc/cp/parser.c:38643
Please submit a full bug report, [etc.]

This is related to PR 83997, but without -flto. And we have a regression.

[Bug c++/101879] New: Broken diagnostic: 'vec_perm_expr' not supported by dump_expr

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101879

Bug ID: 101879
   Summary: Broken diagnostic: 'vec_perm_expr' not supported by
dump_expr
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: diagnostic
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet produces a garbled diagnostic
('vec_perm_expr' not supported by dump_expr):


template
auto foo(const T& x) -> decltype(__builtin_shuffle(x,x)) { return }


bug.cc: In function 'decltype ('vec_perm_expr' not supported by
dump_expr) foo(const T&)':
bug.cc:6:67: error: expected primary-expression before '}' token
6 | auto foo(const T& x) -> decltype(__builtin_shuffle(x,x)) { return }
  |   ^
bug.cc:6:66: error: expected ';' before '}' token
6 | auto foo(const T& x) -> decltype(__builtin_shuffle(x,x)) { return }
  |  ^~
  |  ;

[Bug c++/101878] New: ICE with invalid lambda definition

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101878

Bug ID: 101878
   Summary: ICE with invalid lambda definition
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: error-recovery, ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 4.9.0
(where generic lambdas were introduced):

===
void foo()
{
  [](auto) [ []{}; ];
}
===


bug.cc: In function 'void foo()':
bug.cc:3:16: error: expected ']' before '{' token
3 |   [](auto) [ []{}; ];
  |^
  |]
bug.cc:3:17: internal compiler error: in dependent_type_p, at cp/pt.c:26774
3 |   [](auto) [ []{}; ];
  | ^
0x6e03a4 dependent_type_p(tree_node*)
../../gcc/gcc/cp/pt.c:26774
0x9b9fcf require_complete_types_for_parms
../../gcc/gcc/cp/decl.c:14232
0x9b9fcf check_function_type
../../gcc/gcc/cp/decl.c:16449
0x9b9fcf start_preparsed_function(tree_node*, tree_node*, int)
../../gcc/gcc/cp/decl.c:16648
0xa17325 start_lambda_function(tree_node*, tree_node*)
../../gcc/gcc/cp/lambda.c:1428
0xaa4ad9 cp_parser_lambda_body
../../gcc/gcc/cp/parser.c:11637
0xaa4ad9 cp_parser_lambda_expression
../../gcc/gcc/cp/parser.c:10965
0xaa5593 cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:5666
0xaa82ed cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7563
0xa91a2a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9893
0xa9233c cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:10197
0xa938b2 cp_parser_expression
../../gcc/gcc/cp/parser.c:10367
0xa96f58 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:12531
0xaa2dff cp_parser_statement
../../gcc/gcc/cp/parser.c:12327
0xaa3e9d cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:12679
0xaa3f78 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:12628
0xac35c0 cp_parser_function_body
../../gcc/gcc/cp/parser.c:24762
0xac35c0 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:24813
0xac428a cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:30898
0xac56c4 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:30814
Please submit a full bug report, [etc.]

[Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays

2021-08-12 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101874

Bug ID: 101874
   Summary: [12 Regression] ICE with auto specifier for arrays
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The two testcases from PR 60628 and PR 60629 (originally fixed in GCC 4.8.3)
started triggering ICEs again on trunk.

PR 60628:
===
#include 

void foo(int i)
{
  auto x[i] = { 0 };
}
===

PR 60629:
===
void foo(int i)
{
  auto(*p)[i] = (int(*)[i])0;
}
===

They also crash in the same functions as before:
tsubst_copy and unify_array_domain
which are eventually called from do_auto_deduction:

PR60628.cc: In function 'void foo(int)':
PR60628.cc:5:11: internal compiler error: in tsubst_copy, at cp/pt.c:17243
5 |   auto x[i] = { 0 };
  |   ^
0x6e7512 tsubst_copy
../../gcc/gcc/cp/pt.c:17243
0xaf1eb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:20870
0xaf3651 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19639
0xaf46d9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19815
0xafd357 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19092
0xb0f64f tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:15475
0xb0f6d3 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:15920
0xaedaff do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
../../gcc/gcc/cp/pt.c:29561
[etc.]


PR60629.cc: In function 'void foo(int)':
PR60629.cc:3:28: internal compiler error: in unify_array_domain, at
cp/pt.c:23278
3 |   auto(*p)[i] = (int(*)[i])0;
  |^
0x6f380d unify_array_domain
../../gcc/gcc/cp/pt.c:23278
0xb0b138 unify
../../gcc/gcc/cp/pt.c:23848
0xb0abc9 unify
../../gcc/gcc/cp/pt.c:23829
0xb081f0 unify_one_argument
../../gcc/gcc/cp/pt.c:22107
0xb154da type_unification_real
../../gcc/gcc/cp/pt.c:6
0xaecaff do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
../../gcc/gcc/cp/pt.c:29637
[etc.]


I suspect that the regression was caused by Marek's commit r12-1933.
Marek, could you please have a look?


Unfortunately, the testsuite did not show the regression because it doesn't
contain the original tescases. The second one wasn't added because it was
deemed a duplicate (which makes sense as both ICEs reappered together).

The first testcase was added as g++.dg/cpp0x/auto42.C, but with a subtle
change: 
  auto x[1] = { 0 };
instead of
  auto x[i] = { 0 };
The version in the testsuite actually never showed the ICE.
So we should probably add the original version to the test.

[Bug c++/62207] [8 Regression] ICE: tree check: expected tree that contains 'decl minimal' structure, have 'overload' in tsubst_copy, at cp/pt.c

2021-08-10 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62207

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|8.0 |9.0
  Known to work||9.1.0

--- Comment #13 from Volker Reichelt  ---
It's fixed in GCC 9, but not 8.

[Bug c++/87805] Incomplete diagnostic for -Wnoexcept

2021-08-10 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87805

Volker Reichelt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Known to fail||8.2.0
 Resolution|--- |FIXED
   Target Milestone|--- |10.0
  Known to work||10.1.0

--- Comment #1 from Volker Reichelt  ---
Fixed by Jason with the patch in PR90992.

[Bug c++/101162] New: [12 Regression] ICE (verify_gimple failed) for switch returning pointer-to-members

2021-06-22 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101162

Bug ID: 101162
   Summary: [12 Regression] ICE (verify_gimple failed) for switch
returning pointer-to-members
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid testcase triggers an ICE on trunk when compiled with "-O2":

===
struct A
{
  int i1, i2, i3, i4, i5, i6;
};

int A::* foo(int i)
{
  switch (i)
  {
case 1: return ::i1;
case 2: return ::i2;
case 3: return ::i3;
case 4: return ::i4;
case 5: return ::i5;
case 6: return ::i6;
  }

  return 0;
}
===

bug.cc: In function 'int A::* foo(int)':
bug.cc:19:1: error: invalid types for 'mult_expr'
   19 | }
  | ^
<<< Unknown tree: offset_type >>>
<<< Unknown tree: offset_type >>>
<<< Unknown tree: offset_type >>>
_7 = 4 * _6;
during GIMPLE pass: switchconv
bug.cc:19:1: internal compiler error: verify_gimple failed
0x11025aa verify_gimple_in_cfg(function*, bool)
../../gcc/gcc/tree-cfg.c:5531
0xfe1587 execute_function_todo
../../gcc/gcc/passes.c:2042
0xfe1fab execute_todo
../../gcc/gcc/passes.c:2096
Please submit a full bug report, [etc.]

This regression was introduced between 2021-06-14 and 2021-06-21.

[Bug c++/61259] [Regression 8/9/10/11] Spurious "ISO C++ forbids zero-size array" warning with -pedantic

2021-04-20 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61259

Volker Reichelt  changed:

   What|Removed |Added

  Known to fail||10.3.0, 4.4.0
 CC||reichelt at gcc dot gnu.org
Summary|Spurious "ISO C++ forbids   |[Regression 8/9/10/11]
   |zero-size array" warning|Spurious "ISO C++ forbids
   |with -pedantic  |zero-size array" warning
   ||with -pedantic
   Last reconfirmed|2014-05-20 00:00:00 |2021-4-20
   Keywords||rejects-valid

--- Comment #4 from Volker Reichelt  ---
If you compile the code with "-pedantic-errors" the code is wrongly rejected,
so marking it as rejects-valid.

Self-contained example:

==
int foo(int x[2])
{
  int i(int(x[0])*1);
  return i;
}
==

[Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant

2021-04-15 Thread reichelt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101

Bug ID: 100101
   Summary: [11 Regression] ICE with
-Wzero-as-null-pointer-constant
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

Compiling the following valid code snippet with
"-Wzero-as-null-pointer-constant" triggers an assertion on trunk.
This is a recent regression from within the last month.

==
template  struct A
{
template  static char foo(U*, int* = 0);
static const bool value = sizeof(foo(static_cast(nullptr))) > 0;
};

template  struct B
{
static const bool value = b;
};

template  struct C
{
typedef B::value> type;
};

template 
void bar() noexcept(A::value && C::type::value) {}

void baz()
{
  bar();
}
==

'
Internal compiler error: Error reporting routines re-entered.
0x8cfbf8 convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
../../gcc/gcc/cp/call.c:8348
0x8dc177 build_over_call
../../gcc/gcc/cp/call.c:9230
0x8da248 build_new_method_call_1
../../gcc/gcc/cp/call.c:10783
0x8db2af build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int)
../../gcc/gcc/cp/call.c:10858
0xae76dd finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2751
0xa99115 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:20484
0xa969ec tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19958
0xa957f3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19876
0xaa0e48 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19164
0x06 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:26117
0x98fc9a maybe_instantiate_decl(tree_node*)
../../gcc/gcc/cp/decl2.c:5460
0x990ff8 maybe_instantiate_decl(tree_node*)
../../gcc/gcc/cp/decl2.c:5663
0x990ff8 mark_used(tree_node*, int)
../../gcc/gcc/cp/decl2.c:5689
0xa951f0 tsubst_qualified_id
../../gcc/gcc/cp/pt.c:16466
0xa96ee8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19914
0xaa0e48 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19164
0xab59ce tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13384
0xabed23 tsubst_aggr_type
../../gcc/gcc/cp/pt.c:13587
0xa9dd10 tsubst_decl
../../gcc/gcc/cp/pt.c:14847
0xacc3dd instantiate_class_template_1
../../gcc/gcc/cp/pt.c:12031
Please submit a full bug report, [etc.]