[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.]

[Bug c++/94799] [8/9/10 Regression] Calling a member template function fails

2020-08-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

--- Comment #11 from Volker Reichelt  ---
Hi Marek, any news on this one? It's three months now...
Or should I file a new bug for the regression on trunk?

[Bug c++/94799] [8/9/10 Regression] Calling a member template function fails

2020-05-15 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Volker Reichelt  changed:

   What|Removed |Added

 CC||reichelt at gcc dot gnu.org

--- Comment #9 from Volker Reichelt  ---
Hi Marek,

your fix unfortunately breaks the following valid code (reduced from pybind11):

===
template  struct A
{
  typedef int type;
  operator int();
};

template  using B = A;

template  typename B::type foo(B b)
{
  return b.operator typename B::type();
}

void bar()
{
  foo(A());
}
===

bug.cc: In instantiation of 'typename B::type foo(B) [with T = int;
typename B::type = int; B = A; B = A]':
bug.cc:16:15:   required from here
bug.cc:11:36: error: no type named 'B' in 'struct A'
   11 |   return b.operator typename B::type();
  |  ~~^~~~

[Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c

2020-04-09 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94523

--- Comment #6 from Volker Reichelt  ---
Please ignore my previous comment, it really only fails with -std=c++14 or
-std=c++11 .

[Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c

2020-04-09 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94523

--- Comment #5 from Volker Reichelt  ---
Btw, larger testcases also fail with -std=c++2a, so it's not restricted to
-std=c++14

[Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c

2020-04-09 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94523

Volker Reichelt  changed:

   What|Removed |Added

 CC||reichelt at gcc dot gnu.org

--- Comment #4 from Volker Reichelt  ---
Here's a simpler testcase without variadic templates and template alias:

===
struct A
{
  char c;
  constexpr A(int) : c() {}
};

template struct B
{
  static constexpr auto X = A(N);
};

constexpr A a = B<0>::X;
===

[Bug c++/90754] [10 Regression] ICE: tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_list’ in lookup_type_scope_1, at cp/name-lookup.c:6492 since r271912

2019-06-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90754

Volker Reichelt  changed:

   What|Removed |Added

 CC||nathan at gcc dot gnu.org

--- Comment #1 from Volker Reichelt  ---
Nathan, as your patch broke this, would you mind having a look?

[Bug c++/89958] New: ICE and duplicate diagnostic with invalid return value

2019-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89958

Bug ID: 89958
   Summary: ICE and duplicate diagnostic with invalid return value
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Keywords: diagnostic, 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 6.1.0,
killing the diagnostic in mid-sentence. In addition, the first part
of the diagnostic is emitted twice:

=
struct A;

constexpr auto foo(A* p)
{
  return *p;
}
=

bug.cc: In function 'constexpr auto foo(A*)':
bug.cc:5:11: error: invalid use of incomplete type 'struct A'
5 |   return *p;
  |   ^
bug.cc:1:8: note: forward declaration of 'struct A'
1 | struct A;
  |^
bug.cc:5:10: error: invalid use of incomplete type 'struct A'
5 |   return *p;
  |  ^~
bug.cc:1:8: note: forward declaration of 'struct A'
1 | struct A;
  |^
bug.cc:3:16: error: invalid return type 'A' of 'constexpr' function 'constexpr
auto foo(A*)'
3 | constexpr auto foo(A* p)
  |^~~
bug.cc:1:8: note: 'A' is not literal because:
1 | struct A;
  |^
bug.cc:6:1: internal compiler error: Segmentation fault
6 | }
  | ^
0xf8203f crash_signal
../../gcc/gcc/toplev.c:326
0x8d0333 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3175
0x8d0333 explain_non_literal_class(tree_node*)
../../gcc/gcc/cp/class.c:5525
0x8d91f0 is_valid_constexpr_fn(tree_node*, bool)
../../gcc/gcc/cp/constexpr.c:239
0x8e8c82 register_constexpr_fundef(tree_node*, tree_node*)
../../gcc/gcc/cp/constexpr.c:871
0x92e967 maybe_save_function_definition
../../gcc/gcc/cp/decl.c:15949
0x92e967 finish_function(bool)
../../gcc/gcc/cp/decl.c:16096
0x9cd454 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:27803
0x9ce199 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:27716
0x9ce199 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:20295
0x9b049e cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13539
0x9d41c0 cp_parser_declaration
../../gcc/gcc/cp/parser.c:13236
0x9d493c cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4698
0x9d493c c_parse_file()
../../gcc/gcc/cp/parser.c:41180
0xadae9b c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1156
Please submit a full bug report, [etc.]

[Bug c++/89917] New: [8/9 Regression] ICE with lambda in variadic template hierarchy

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89917

Bug ID: 89917
   Summary: [8/9 Regression] ICE with lambda in variadic template
hierarchy
   Product: gcc
   Version: 9.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 8.2.0,
so this is a regression on the GCC 8 branch.

=
struct A 
{
  A(...);
};

template struct B : T...
{
  B() : T([]{})... {}
};

B b;
=

bug.cc: In instantiation of 'B::B() [with T = {A}]':
bug.cc:11:6:   required from here
bug.cc:8:16: internal compiler error: tree check: expected tree_vec, have
type_pack_expansion in tsubst_initializer_list, at cp/pt.c:24915
8 |   B() : T([]{})... {}
  |^~~
0x7da784 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9881
0x65d072 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3176
0x65d072 tsubst_initializer_list
../../gcc/gcc/cp/pt.c:24915
0x9ff648 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16981
0x9ff95d tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16976
0x9fea39 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17277
0x9fe3b8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:24730
0xa244db instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:24846
0x941600 c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4818
Please submit a full bug report, [etc.]

[Bug c++/89917] [8/9 Regression] ICE with lambda in variadic template hierarchy

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89917

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|--- |8.4

[Bug c++/89914] [9 Regression] ICE in nothrow_spec_p, at cp/except.c:1238

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89914

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug c++/89914] New: [9 Regression] ICE in nothrow_spec_p, at cp/except.c:1238

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89914

Bug ID: 89914
   Summary: [9 Regression] ICE in nothrow_spec_p, at
cp/except.c:1238
   Product: gcc
   Version: 9.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
CC: jason at gcc dot gnu.org, paolo.carlini at oracle dot com
  Target Milestone: ---

The following invalid testcase triggers an ICE on trunk:


struct A
{
  int i = ;
};

bool b = __has_nothrow_constructor (A);


bug.cc:3:9: error: expected primary-expression at end of input
3 |   int i = ;
  | ^
bug.cc:6:38: internal compiler error: in nothrow_spec_p, at cp/except.c:1238
6 | bool b = __has_nothrow_constructor (A);
  |  ^
0x614d85 nothrow_spec_p(tree_node const*)
../../gcc/gcc/cp/except.c:1238
0xa42acf finish_trait_expr(cp_trait_kind, tree_node*, tree_node*)
../../gcc/gcc/cp/semantics.c:9788
0x9c5a59 cp_parser_trait_expr
../../gcc/gcc/cp/parser.c:10365
0x9b58bf cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:5544
0x9b9ccb cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7175
0x9c75c9 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8469
0x9a185f cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:9355
0x9a206a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9458
0x9a3007 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9756
0x9a2a0d cp_parser_constant_expression
../../gcc/gcc/cp/parser.c:10038
0x9a2fb1 cp_parser_initializer_clause
../../gcc/gcc/cp/parser.c:22814
0x9a6d6f cp_parser_initializer
../../gcc/gcc/cp/parser.c:22752
0x9cdc99 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:20468
0x9b029e cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13539
0x9d3fc0 cp_parser_declaration
../../gcc/gcc/cp/parser.c:13236
0x9d473c cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4698
0x9d473c c_parse_file()
../../gcc/gcc/cp/parser.c:41180
0xadaa9b c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1156
Please submit a full bug report, [etc.]

The ICE is similar to PR89571, it also regressed in February 2019.
Alas the patch there did not fix it.

[Bug c++/89913] [7/8/9 Regression] [concepts] ICE with invalid using declaration

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89913

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|--- |7.5

[Bug c++/89913] New: [7/8/9 Regression] [concepts] ICE with invalid using declaration

2019-04-01 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89913

Bug ID: 89913
   Summary: [7/8/9 Regression] [concepts] ICE with invalid using
declaration
   Product: gcc
   Version: 9.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
CC: paolo.carlini at oracle dot com
Blocks: 67491
  Target Milestone: ---

The following invalid testcase (compiled with "-fconcepts")
triggers an ICE since GCC 6.1.0:

=
template using A = auto;

template using B = A;
=

bug.cc:1:33: error: 'auto' not allowed in alias declaration
1 | template using A = auto;
  | ^~~~
bug.cc:3:41: internal compiler error: Segmentation fault
3 | template using B = A;
  | ^
0xf81b6f crash_signal
../../gcc/gcc/toplev.c:326
0x9e7869 get_underlying_template
../../gcc/gcc/cp/pt.c:6174
0xa0e8ef lookup_template_class_1
../../gcc/gcc/cp/pt.c:9294
0xa0e8ef lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:9728
0xa3ac3b finish_template_type(tree_node*, tree_node*, int)
../../gcc/gcc/cp/semantics.c:3312
0x9b871d cp_parser_template_id
../../gcc/gcc/cp/parser.c:16479
0x9b88b7 cp_parser_class_name
../../gcc/gcc/cp/parser.c:23274
0x9bb9d0 cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:6693
0x9bb9d0 cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6379
0x9b9073 cp_parser_simple_type_specifier
../../gcc/gcc/cp/parser.c:17837
0x9aeae5 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:17505
0x9c3478 cp_parser_type_specifier_seq
../../gcc/gcc/cp/parser.c:21983
0x9c0544 cp_parser_type_id_1
../../gcc/gcc/cp/parser.c:21812
0x9c52c3 cp_parser_type_id
../../gcc/gcc/cp/parser.c:21891
0x9c52c3 cp_parser_alias_declaration
../../gcc/gcc/cp/parser.c:19643
0x9d0ee7 cp_parser_template_declaration_after_parameters
../../gcc/gcc/cp/parser.c:27851
0x9d1617 cp_parser_explicit_template_declaration
../../gcc/gcc/cp/parser.c:28104
0x9d1617 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:28123
0x9d40e9 cp_parser_declaration
../../gcc/gcc/cp/parser.c:13185
0x9d473c cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4698
Please submit a full bug report, [etc.]

This is similar to PR84423, but hasn't been fixed yet.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/81866] [7/8/9 Regression] ICE with a default template parameter which is a template class nested in a template class

2019-03-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81866

Volker Reichelt  changed:

   What|Removed |Added

   Last reconfirmed|2017-09-11 00:00:00 |2019-3-17
 CC||reichelt at gcc dot gnu.org
   Target Milestone|--- |7.5
Summary|ICE with a default template |[7/8/9 Regression] ICE with
   |parameter which is a|a default template
   |template class nested in a  |parameter which is a
   |template class  |template class nested in a
   ||template class

--- Comment #2 from Volker Reichelt  ---
This is a regression that was introduced in GCC 4.5.0.

[Bug c++/79308] ICE on specialization of nested template classes (in finish_member_declaration, at cp/semantics.c:2963)

2019-03-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79308

Volker Reichelt  changed:

   What|Removed |Added

 CC||reichelt at gcc dot gnu.org
 Depends on||89744

--- Comment #5 from Volker Reichelt  ---
IMHO the testcase is invalid (e.g. clang rejects it).
But by changing the line
  struct Element::WriteOutput
into
  struct Element::WriteOutput
it can be turned into a valid testcase.

There are several similar testcases, so I opened a new PR 89744 for this.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89744
[Bug 89744] [8/9 Regression] ICE with specialization of nested template class

[Bug c++/89744] [8/9 Regression] ICE with specialization of nested template class

2019-03-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89744

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|--- |8.4

[Bug c++/89744] New: [8/9 Regression] ICE with specialization of nested template class

2019-03-17 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89744

Bug ID: 89744
   Summary: [8/9 Regression] ICE with specialization of nested
template class
   Product: gcc
   Version: 9.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 since GCC 8.1.0:


template struct A
{
  template struct B {};
  A() { B b; }
};

template<> template
struct A::B
{
  virtual void foo() {}
};

A a;


bug.cc: In instantiation of 'struct A::B':
bug.cc:10:16:   recursively required from 'void A::B<
 >::foo() [with  = int]'
bug.cc:10:16:   required from here
bug.cc:9:1: internal compiler error: in finish_member_declaration, at
cp/semantics.c:3126
9 | {
  | ^
0x68321f finish_member_declaration(tree_node*)
../../gcc/gcc/cp/semantics.c:3126
0xa3175f instantiate_class_template_1
../../gcc/gcc/cp/pt.c:11167
0xa3175f instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:11468
0xa7750d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:138
0xa3f0af lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
../../gcc/gcc/cp/search.c:1129
0x994575 get_class_binding
../../gcc/gcc/cp/name-lookup.c:4451
0x9991bf outer_binding(tree_node*, cxx_binding*, bool)
../../gcc/gcc/cp/name-lookup.c:6330
0x9a07d4 check_local_shadow
../../gcc/gcc/cp/name-lookup.c:2631
0x9a07d4 do_pushdecl
../../gcc/gcc/cp/name-lookup.c:3097
0x9a07d4 pushdecl(tree_node*, bool)
../../gcc/gcc/cp/name-lookup.c:3162
0x928dfe store_parm_decls
../../gcc/gcc/cp/decl.c:15683
0x928dfe start_preparsed_function(tree_node*, tree_node*, int)
../../gcc/gcc/cp/decl.c:1
0xa2fb66 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:24643
0xa33c8b instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:24777
0x952258 c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4802
Please submit a full bug report, [etc.]


However, similar testcases regressed with different releases.
ICE since GCC 4.0.0:


template struct A
{
  template struct B {};
  A() { B b; }
};

template<> template
struct A::B
{
  virtual void foo() {}
  void bar() {}
};

A a;


ICE since GCC 3.2.3:


template struct A
{
  template struct B {};
  A() { B b; }
};

template<> template
struct A::B
{
  ~B() {}
};

A a;


ICE since GCC 4.8.4:


template struct A
{
  template struct B {};
  typedef B X;
};

template<> template
struct A::B
{
  typedef int Y;
};

A::B b;


[Bug c++/89571] [9 Regression] ICE in nothrow_spec_p, at cp/except.c:1238

2019-03-16 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89571

Volker Reichelt  changed:

   What|Removed |Added

 CC||reichelt at gcc dot gnu.org

--- Comment #6 from Volker Reichelt  ---
Here's a related testcase that ICEs in a different location
(and also regressed in February):


struct A
{
  int i = ;
  A() noexcept = default;
};


bug.cc:3:9: error: expected primary-expression at end of input
3 |   int i = ;
  | ^
bug.cc:5:2: internal compiler error: tree check: expected tree_list, have
error_mark in comp_except_specs, at cp/typeck.c:1048
5 | };
  |  ^
0x7ebe52 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9859
0x6999e0 tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3432
0x6999e0 comp_except_specs(tree_node const*, tree_node const*, int)
../../gcc/gcc/cp/typeck.c:1048
0x990ad6 after_nsdmi_defaulted_late_checks(tree_node*)
../../gcc/gcc/cp/method.c:2277
0x9bf206 cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:23611
0x9c038d cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:23652
0x9c038d cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:17397
0x9c12b4 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:14090
0x9c1aa1 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13385
0x9e4590 cp_parser_declaration
../../gcc/gcc/cp/parser.c:13204
0x9e4d0c cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4698
0x9e4d0c c_parse_file()
../../gcc/gcc/cp/parser.c:41148
0xaeb18b c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1156
Please submit a full bug report, [etc.]

[Bug c++/89709] [9 Regression] ICE with constexpr and "-O"

2019-03-13 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89709

Volker Reichelt  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug c++/89709] New: [9 Regression] ICE with constexpr and "-O"

2019-03-13 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89709

Bug ID: 89709
   Summary: [9 Regression] ICE with constexpr and "-O"
   Product: gcc
   Version: 9.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 "-O") triggers an ICE on trunk:

=
struct A
{
  int i;
};

A a;

constexpr int* foo()
{
  return 
}

bool bar()
{
  return foo() == 
}
=

bug.cc: In function 'bool bar()':
bug.cc:15:22: internal compiler error: in operand_equal_p, at fold-const.c:2962
   15 |   return foo() == 
  |  ^
0x6e8344 operand_equal_p(tree_node const*, tree_node const*, unsigned int)
../../gcc/gcc/fold-const.c:2962
0x141f84d generic_simplify_EQ_EXPR
/tmp/gccbuild/src-9/build/gcc/generic-match.c:41813
0x144dc1d generic_simplify(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
/tmp/gccbuild/src-9/build/gcc/generic-match.c:52806
0xc4e885 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/gcc/fold-const.c:9378
0xc56c99 fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/gcc/fold-const.c:12350
0x8c112a cp_fold
../../gcc/gcc/cp/cp-gimplify.c:2448
0x8c30ec cp_fold_maybe_rvalue(tree_node*, bool)
../../gcc/gcc/cp/cp-gimplify.c:2126
0xa29908 maybe_warn_about_returning_address_of_local
../../gcc/gcc/cp/typeck.c:9183
0xa3f9c6 check_return_expr(tree_node*, bool*)
../../gcc/gcc/cp/typeck.c:9751
0x9f955f finish_return_stmt(tree_node*)
../../gcc/gcc/cp/semantics.c:895
0x979f77 cp_parser_jump_statement
../../gcc/gcc/cp/parser.c:12848
0x979f77 cp_parser_statement
../../gcc/gcc/cp/parser.c:11120
0x97a678 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11586
0x97a758 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11540
0x992c95 cp_parser_function_body
../../gcc/gcc/cp/parser.c:22521
0x992c95 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:22558
0x99351b cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:27621
0x994269 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:27537
0x994269 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:20196
0x976f62 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13470
Please submit a full bug report, [etc.]

The regression was introduced between 2018-12-14 and 2019-01-12.

[Bug c++/88754] [7/8/9 Regression] Constructor call wrongly assumed to be a variable declaration

2019-01-08 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88754

Volker Reichelt  changed:

   What|Removed |Added

  Known to work||3.4.0, 3.4.6, 4.1.0, 4.1.1
Summary|Constructor call wrongly|[7/8/9 Regression]
   |assumed to be a variable|Constructor call wrongly
   |declaration |assumed to be a variable
   ||declaration
  Known to fail||4.1.2, 4.2.0, 5.0, 6.0,
   ||7.0, 8.0, 9.0

--- Comment #2 from Volker Reichelt  ---
Unlike PR37213 this is actually a regression that was introduced in GCC 4.1.2.
The code compiled fine with GCC 3.4.0 - GCC 4.1.1.

[Bug c++/88754] New: Constructor call wrongly rejected

2019-01-08 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88754

Bug ID: 88754
   Summary: Constructor call wrongly rejected
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Keywords: rejects-valid
  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 is wrongly rejected
(since at least GCC 4.1, probably even before):

=
struct A
{
  A(int);
  void foo();
};

template int value() { return N; }

void bar()
{
  A(value<0>()).foo();// fails
  (A(value<0>())).foo();  // OK
}
=

bug.cc: In function 'void bar()':
bug.cc:11:4: error: invalid declaration of '::value<0>'
   11 |   A(value<0>()).foo();
  |^


The code is compiled by clang and MSVC.

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

2018-10-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87805

Bug ID: 87805
   Summary: Incomplete diagnostic for -Wnoexcept
   Product: gcc
   Version: 8.2.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 warning option "-Wnoexcept" produces incomplete diagnostics
for the following testcase:

==
#include 

struct Hash
{
  char operator()(char) const { return 0; }
};

std::unordered_set x;
==

==
/gcc-8.2.0/include/c++/8.2.0/type_traits: In instantiation of 'constexpr bool
std::__call_is_nt(std::__invoke_other) [with _Fn = const Hash&; _Args = {const
char&}]':
/gcc-8.2.0/include/c++/8.2.0/type_traits:2658:34:   required by substitution of
'template using __bool_constant = std::integral_constant
[with bool __v = std::__call_is_nt((std::__result_of_success::__invoke_type{},
std::__result_of_success::__invoke_type()))]'
/gcc-8.2.0/include/c++/8.2.0/type_traits:2656:12:   required from 'struct
std::__call_is_nothrow, const
Hash&, const char&>'
/gcc-8.2.0/include/c++/8.2.0/type_traits:131:12:   required from 'struct
std::__and_,
std::__call_is_nothrow, const
Hash&, const char&> >'
/gcc-8.2.0/include/c++/8.2.0/type_traits:2668:12:   required from 'struct
std::__is_nothrow_invocable'
/gcc-8.2.0/include/c++/8.2.0/type_traits:131:12:   required from 'struct
std::__and_, std::__is_nothrow_invocable >'
/gcc-8.2.0/include/c++/8.2.0/type_traits:142:31:   required from 'struct
std::__not_,
std::__is_nothrow_invocable > >'
/gcc-8.2.0/include/c++/8.2.0/bits/unordered_set.h:99:63:   required from 'class
std::unordered_set'
bug.cc:8:32:   required from here
bug.cc:5:8: warning: but 'char Hash::operator()(char) const' does not throw;
perhaps it should be declared 'noexcept' [-Wnoexcept]
   char operator()(char) const { return 0; }
^~~~
==

Only with the additional option "-Wsystem-headers" you get the complete
diagnostics:

==
In file included from /gcc-8.2.0/include/c++/8.2.0/unordered_set:38,
 from bug.cc:1:
/gcc-8.2.0/include/c++/8.2.0/type_traits: In instantiation of 'constexpr bool
std::__call_is_nt(std::__invoke_other) [with _Fn = const Hash&; _Args = {const
char&}]':
/gcc-8.2.0/include/c++/8.2.0/type_traits:2658:34:   required by substitution of
'template using __bool_constant = std::integral_constant
[with bool __v = std::__call_is_nt((std::__result_of_success::__invoke_type{},
std::__result_of_success::__invoke_type()))]'
/gcc-8.2.0/include/c++/8.2.0/type_traits:2656:12:   required from 'struct
std::__call_is_nothrow, const
Hash&, const char&>'
/gcc-8.2.0/include/c++/8.2.0/type_traits:131:12:   required from 'struct
std::__and_,
std::__call_is_nothrow, const
Hash&, const char&> >'
/gcc-8.2.0/include/c++/8.2.0/type_traits:2668:12:   required from 'struct
std::__is_nothrow_invocable'
/gcc-8.2.0/include/c++/8.2.0/type_traits:131:12:   required from 'struct
std::__and_, std::__is_nothrow_invocable >'
/gcc-8.2.0/include/c++/8.2.0/type_traits:142:31:   required from 'struct
std::__not_,
std::__is_nothrow_invocable > >'
/gcc-8.2.0/include/c++/8.2.0/bits/unordered_set.h:99:63:   required from 'class
std::unordered_set'
bug.cc:8:32:   required from here
/gcc-8.2.0/include/c++/8.2.0/type_traits:2652:68: warning: noexcept-expression
evaluates to 'false' because of a call to 'char Hash::operator()(char) const'
[-Wnoexcept]
   return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
^
bug.cc:5:8: warning: but 'char Hash::operator()(char) const' does not throw;
perhaps it should be declared 'noexcept' [-Wnoexcept]
   char operator()(char) const { return 0; }
^~~~
==

The culprit seems to be the function maybe_noexcept_warning from cp/except.c
where both parts of the warning are emitted as separate warnings.
The first part is (wrongly) suppressed when it is located in a system header:

static void
maybe_noexcept_warning (tree fn)
{
  if (TREE_NOTHROW (fn))
{
  warning (OPT_Wnoexcept, "noexcept-expression evaluates to % "
   "because of a call to %qD", fn);
  warning_at (DECL_SOURCE_LOCATION (fn), OPT_Wnoexcept,
  "but %qD does not throw; perhaps "
  "it should be declared %", fn);
}
}

[Bug c++/87425] New: [9 Regression] ICE with virtual assignment operator

2018-09-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87425

Bug ID: 87425
   Summary: [9 Regression] ICE with virtual assignment operator
   Product: gcc
   Version: 9.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
CC: jakub at gcc dot gnu.org, mpolacek at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-std=c++2a") triggers an ICE
on trunk:

=
struct A
{
  virtual A& operator= (int);
};

struct B
{
  A a;
  B() { a = 0; }
};
=

bug.cc: In constructor 'B::B()':
bug.cc:9:14: internal compiler error: Segmentation fault
9 |   B() { a = 0; }
  |  ^
0xed7eef crash_signal
../../gcc/gcc/toplev.c:325
0x8760fc tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3112
0x8760fc cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4821
0x8791be cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/constexpr.c:5018
0x87c6fc maybe_constant_init_1
../../gcc/gcc/cp/constexpr.c:5366
0x8914f0 cp_get_fndecl_from_callee(tree_node*, bool)
../../gcc/gcc/cp/cvt.c:967
0x8915fb maybe_warn_nodiscard
../../gcc/gcc/cp/cvt.c:1016
0x891ea7 convert_to_void(tree_node*, impl_conv_void, int)
../../gcc/gcc/cp/cvt.c:1398
0x9c15a0 finish_expr_stmt(tree_node*)
../../gcc/gcc/cp/semantics.c:686
0x93e977 cp_parser_statement
../../gcc/gcc/cp/parser.c:10963
0x93fe98 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11302
0x93ff7f cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11256
0x956100 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21930
0x956100 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21967
0x956970 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26982
0x9585ec cp_parser_late_parsing_for_member
../../gcc/gcc/cp/parser.c:27862
0x94b1ff cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:22906
0x94c1eb cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:22932
0x94c1eb cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:16920
0x958d19 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13757
Please submit a full bug report, [etc.]

This seems to be related to PR87398.

[Bug c++/68429] [concepts] ICE in in placeholder_extract_concept_and_args, at cp/constraint.cc:1401

2018-09-19 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68429

Volker Reichelt  changed:

   What|Removed |Added

 CC||paolo.carlini at oracle dot com

--- Comment #2 from Volker Reichelt  ---
This seems to be fixed on trunk.

Paolo, one of your recent concept patches might be responsible for this (maybe
the one for PR85065). Could you confirm this? Do we want to add another
testcase for this?

[Bug c++/68429] [concepts] ICE in in placeholder_extract_concept_and_args, at cp/constraint.cc:1401

2018-09-19 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68429

--- Comment #3 from Volker Reichelt  ---
Btw, the code snippet from comment #1 is accepted on trunk.

[Bug c++/65608] [meta-bug] friend issues

2018-09-19 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65608
Bug 65608 depends on bug 13166, which changed state.

Bug 13166 Summary: [DR136] not implemented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13166

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

[Bug c++/59480] Missing error diagnostic: friend declaration specifying a default argument must be a definition

2018-09-19 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59480

Volker Reichelt  changed:

   What|Removed |Added

 CC||rafael.espindola at ic dot 
unicamp
   ||.br

--- Comment #23 from Volker Reichelt  ---
*** Bug 13166 has been marked as a duplicate of this bug. ***

[Bug c++/13166] [DR136] not implemented

2018-09-19 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13166

Volker Reichelt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #9 from Volker Reichelt  ---
Fixed by Paolo's patches for PR59480.

*** This bug has been marked as a duplicate of bug 59480 ***

[Bug libstdc++/87061] New: [9 Regression] regex cannot be compiled with -std=c++1z -D_GLIBCXX_USE_CXX11_ABI=0

2018-08-22 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87061

Bug ID: 87061
   Summary: [9 Regression] regex cannot be compiled with
-std=c++1z -D_GLIBCXX_USE_CXX11_ABI=0
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Keywords: rejects-valid
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

Using the regex header (like in the code snippet below) with the the options
"-std=c++1z -D_GLIBCXX_USE_CXX11_ABI=0" results in an error message.

This is a regression introduced between 2018-07-26 and 2018-08-17.

===
#include 
===

In file included from /gcc-9/include/c++/9.0.0/string:52,
 from /gcc-9/include/c++/9.0.0/bitset:47,
 from /gcc-9/include/c++/9.0.0/regex:39,
 from bug.cc:1:
/gcc-9/include/c++/9.0.0/bits/basic_string.h: In instantiation of 'class
std::basic_string,
std::pmr::polymorphic_allocator >':
/gcc-9/include/c++/9.0.0/regex:77:41:   required from here
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3103:63: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3103 |   typedef typename _Alloc::template rebind<_CharT>::other
_CharT_alloc_type;
 |  
^
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3116:68: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3116 |   typedef __gnu_cxx::__normal_iterator 
iterator;
 |   
^~~~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3118:61: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3118 |
const_iterator;
 |
^~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3119:53: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3119 |   typedef std::reverse_iterator
const_reverse_iterator;
 |
^~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3120:52: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3120 |   typedef std::reverse_iterator  reverse_iterator;
 |^~~~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5233:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5233 |  find(const _Tp& __svt, size_type __pos = 0) const
 |  ^~~~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5311:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5311 |  rfind(const _Tp& __svt, size_type __pos = npos) const
 |  ^
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5395:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5395 |  find_first_of(const _Tp& __svt, size_type __pos = 0) const
 |  ^
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5479:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5479 |  find_last_of(const _Tp& __svt, size_type __pos = npos) const
 |  ^~~~
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5560:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5560 |  find_first_not_of(const _Tp& __svt, size_type __pos = 0) const
 |  ^
/gcc-9/include/c++/9.0.0/bits/basic_string.h:5642:2: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
5642 |  find_last_not_of(const _Tp& __svt, size_type __pos = npos) const
 |  ^~~~
In file included from bug.cc:3:
/gcc-9/include/c++/9.0.0/regex:77:57: error: template argument 1 is invalid
77 | using smatch  = match_results;
   | ^
In file included from /gcc-9/include/c++/9.0.0/string:52,
 from /gcc-9/include/c++/9.0.0/bitset:47,
 from /gcc-9/include/c++/9.0.0/regex:39,
 from bug.cc:1:
/gcc-9/include/c++/9.0.0/bits/basic_string.h: In instantiation of 'class
std::basic_string,
std::pmr::polymorphic_allocator >':
/gcc-9/include/c++/9.0.0/regex:80:42:   required from here
/gcc-9/include/c++/9.0.0/bits/basic_string.h:3103:63: error: no class template
named 'rebind' in 'class std::pmr::polymorphic_allocator'
3103 |   typedef typename _Alloc::template rebind<_CharT>::other
_CharT_alloc_type;
 |  
^
/gcc-9/include/c++/9.0.0/b

[Bug c++/84767] [6 Regression] ICE with pointer to VLA

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84767

Volker Reichelt  changed:

   What|Removed |Added

Summary|[6/7 Regression] ICE with   |[6 Regression] ICE with
   |pointer to VLA  |pointer to VLA

--- Comment #7 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85068] [6 Regression] ICE with invalid covariant return type hierarchy

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85068

Volker Reichelt  changed:

   What|Removed |Added

Summary|[6/7 Regression] ICE with   |[6 Regression] ICE with
   |invalid covariant return|invalid covariant return
   |type hierarchy  |type hierarchy

--- Comment #6 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85076] [6 Regression] ICE with invalid template used as lambda argument

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85076

Volker Reichelt  changed:

   What|Removed |Added

Summary|[6/7 Regression] ICE with   |[6 Regression] ICE with
   |invalid template used as|invalid template used as
   |lambda argument |lambda argument

--- Comment #9 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85140] [6 Regression] ICE with invalid use of alignas

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85140

Volker Reichelt  changed:

   What|Removed |Added

Summary|[6/7 Regression] ICE with   |[6 Regression] ICE with
   |invalid use of alignas  |invalid use of alignas

--- Comment #6 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85208] ICE with #pragma weak and structured binding

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85208

Volker Reichelt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.4

--- Comment #6 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85210] [7 Regression] ICE with broken structured binding in template

2018-06-24 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85210

Volker Reichelt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Volker Reichelt  ---
Fixed for GCC 7.4

[Bug c++/85545] New: [8/9 Regression] ICE with static_cast of pointer-to-member-function

2018-04-26 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85545

Bug ID: 85545
   Summary: [8/9 Regression] ICE with static_cast of
pointer-to-member-function
   Product: gcc
   Version: 8.0.1
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
CC: jakub at gcc dot gnu.org, rguenth at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet (compiled with "-std=c++17 -Wformat"
or "-std=c++17 -Wall") triggers an ICE with the GCC 8 release candidate
and on trunk:

==
struct A
{
  void foo() noexcept;
};

template void bar(T);

void baz()
{
  bar(static_cast<void(A::*)()>(::foo));
}
==

bug.cc: In function 'void baz()':
bug.cc:10:41: internal compiler error: in fold_convert_loc, at
fold-const.c:2524
   bar(static_cast<void(A::*)()>(::foo));
 ^
0x6c4cf4 fold_convert_loc(unsigned int, tree_node*, tree_node*)
../../gcc/gcc/fold-const.c:2524
0x87539c cp_fold_convert(tree_node*, tree_node*)
../../gcc/gcc/cp/cvt.c:612
0x859760 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4613
0x85d0b7 cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/constexpr.c:4861
0x85fed6 maybe_constant_value(tree_node*, tree_node*)
../../gcc/gcc/cp/constexpr.c:5079
0x821a5b build_over_call
../../gcc/gcc/cp/call.c:8078
0x82f1bf build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
../../gcc/gcc/cp/call.c:4319
0x9ade95 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2534
0x938e2a cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7235
0x939681 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8317
0x9194ef cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:9085
0x919cfa cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9186
0x91b534 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9481
0x91bc38 cp_parser_expression
../../gcc/gcc/cp/parser.c:9650
0x91d918 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:11132
0x923d4d cp_parser_statement
../../gcc/gcc/cp/parser.c:10936
0x9252c0 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11275
0x925397 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11229
0x93bfa0 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21802
0x93bfa0 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21839
Please submit a full bug report, [etc.]

This is a very recent regression, introduced between 2018-04-22
and the release candidate.

Jakub, I think this is related to your commit, r259629.
I also think that this might qualify as release blocker.

[Bug c++/82099] internal compiler error: in type_throw_all_p, at cp/except.c:1186 when using a function pointer for templated predicate

2018-04-13 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82099

Volker Reichelt  changed:

   What|Removed |Added

   Last reconfirmed|2017-09-04 00:00:00 |2018-4-13
 CC||reichelt at gcc dot gnu.org

--- Comment #5 from Volker Reichelt  ---
On trunk (GCC 8) the testcases of comment #2 and comment #4 only crash with
-std=c++17, but don't crash with -std=c++11 or -std=c++14.

[Bug c++/85356] New: [7/8 Regression] ICE with operator=

2018-04-11 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85356

Bug ID: 85356
   Summary: [7/8 Regression] ICE with operator=
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  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
when compiled with "-std=c++1z":

==
struct A
{
  A& operator=(int);
};

void foo(A&(A::*)(int));

template void bar()
{
  foo(::operator=);
}
==

bug.cc: In function 'void bar()':
bug.cc:10:20: internal compiler error: in type_throw_all_p, at cp/except.c:1185
   foo(::operator=);
^
0x610678 type_throw_all_p(tree_node const*)
../../gcc/gcc/cp/except.c:1185
0x878e58 noexcept_conv_p
../../gcc/gcc/cp/cvt.c:2015
0x878e58 fnptr_conv_p(tree_node*, tree_node*)
../../gcc/gcc/cp/cvt.c:2041
0x8370d1 resolve_address_of_overloaded_function
../../gcc/gcc/cp/class.c:7713
0x81de96 standard_conversion
../../gcc/gcc/cp/call.c:1122
0x82989f implicit_conversion
../../gcc/gcc/cp/call.c:1843
0x82ad9a add_function_candidate
../../gcc/gcc/cp/call.c:2203
0x82c45b add_candidates
../../gcc/gcc/cp/call.c:5533
0x82c8d1 add_candidates
../../gcc/gcc/cp/call.c:4192
0x82c8d1 perform_overload_resolution
../../gcc/gcc/cp/call.c:4200
0x82e942 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
../../gcc/gcc/cp/call.c:4273
0x9ace05 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2534
0x93813a cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7235
0x938990 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8314
0x91880f cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:9082
0x91901a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9183
0x91a854 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9478
0x91af58 cp_parser_expression
../../gcc/gcc/cp/parser.c:9647
0x91cc38 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:11123
0x92306d cp_parser_statement
../../gcc/gcc/cp/parser.c:10927
Please submit a full bug report, [etc.]

[Bug c++/85285] New: [6/7/8 Regression] ICE with flexible array in union

2018-04-08 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85285

Bug ID: 85285
   Summary: [6/7/8 Regression] ICE with flexible array in union
   Product: gcc
   Version: 8.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
  Target Milestone: ---

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

=
template struct A
{
  union
  {
T x;
  };
};

A<int[]> a;
=

bug.cc: In instantiation of 'union A::':
bug.cc:3:3:   required from 'struct A'
bug.cc:9:10:   required from here
bug.cc:4:3: internal compiler error: Segmentation fault
   {
   ^
0xebdf8f crash_signal
../../gcc/gcc/toplev.c:325
0xbf84cb contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3248
0xbf84cb size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*)
../../gcc/gcc/fold-const.c:1883
0xeb2937 place_union_field
../../gcc/gcc/stor-layout.c:1193
0xeb2937 place_field(record_layout_info_s*, tree_node*)
../../gcc/gcc/stor-layout.c:1253
0x839a22 layout_nonempty_base_or_field
../../gcc/gcc/cp/class.c:4048
0x8454f4 layout_class_type
../../gcc/gcc/cp/class.c:6109
0x84a7ea finish_struct_1(tree_node*)
../../gcc/gcc/cp/class.c:6804
0x9928ab instantiate_class_template_1
../../gcc/gcc/cp/pt.c:11060
0x9928ab instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:11100
0x9d8f7d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:136
0x99275f instantiate_class_template_1
../../gcc/gcc/cp/pt.c:10896
0x99275f instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:11100
0x9d8f7d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:136
0x885fc7 start_decl_1(tree_node*, bool)
../../gcc/gcc/cp/decl.c:5275
0x8ac267 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/gcc/cp/decl.c:5238
0x93d573 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19610
0x944d48 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13049
0x945b58 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x949ae2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12772
Please submit a full bug report, [etc.]

[Bug c++/85279] New: [6/7/8 Regression] Broken diagnostic for decltype

2018-04-07 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85279

Bug ID: 85279
   Summary: [6/7/8 Regression] Broken diagnostic for decltype
   Product: gcc
   Version: 8.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 testcase produces a broken diagnostic since GCC 4.7.0:


template struct A
{
  void foo(decltype(T())::Y);
};


bug.cc:3:27: error: '#'decltype_type' not supported by dump_expr#::Y' is not a type
   void foo(decltype(T())::Y);
   ^

[Bug c++/85278] New: [concepts] Garbled diagnostic

2018-04-07 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85278

Bug ID: 85278
   Summary: [concepts] Garbled diagnostic
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

The testcase gcc/testsuite/g++.dg/concepts/req2.C produces a broken diagnostic
since GCC 6.1.0:

req2.C:18:14: error: cannot call function 'void f2(auto:2) requires (> [with auto:2
= void*]'

The offending testcase can be reduced to:

==
void f2(auto a)
  requires requires (decltype(a) x) { -x; }
{ }

int main() {
  f2((void*)0);
}
==


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85277] New: [8 Regression] Broken diagnostic for offsetof with static member function

2018-04-07 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85277

Bug ID: 85277
   Summary: [8 Regression] Broken diagnostic for offsetof with
static member function
   Product: gcc
   Version: 8.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 testcase gcc/testsuite/g++.dg/ext/offsetof1.C produces a broken diagnostic
on trunk:

offsetof1.C:15:50: error: cannot apply 'offsetof' to member function
'#'indirect_ref' not supported by dump_decl#'

The offending problem can be reduced to:

==
struct bar {
  static int baz();
};

int bv0 = __builtin_offsetof(volatile bar, baz[0]);
==

The regression was introduced between 2017-11-09 and 2017-11-17.

[Bug c++/85265] New: [concepts] ICE with missing identifier

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85265

Bug ID: 85265
   Summary: [concepts] ICE with missing identifier
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

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

=
template concept bool C = true;

C{} void foo();
=

bug99.cc:3:3: error: expected identifier before '}' token
 C{} void foo();
   ^
bug99.cc:3:3: internal compiler error: tree check: expected identifier_node,
have error_mark in find_local_binding, at cp/name-lookup.c:143
0x78cf20 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9322
0x620722 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3135
0x620722 find_local_binding
../../gcc/gcc/cp/name-lookup.c:143
0x9085f2 do_pushdecl
../../gcc/gcc/cp/name-lookup.c:2998
0x9085f2 pushdecl(tree_node*, bool)
../../gcc/gcc/cp/name-lookup.c:3148
0x95f65a process_template_parm(tree_node*, unsigned int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:4432
0x86575d process_introduction_parm
../../gcc/gcc/cp/constraint.cc:1376
0x86575d finish_template_introduction(tree_node*, tree_node*)
../../gcc/gcc/cp/constraint.cc:1408
0x944368 cp_parser_template_introduction
../../gcc/gcc/cp/parser.c:27066
0x944368 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:27170
0x949714 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12767
0x949b31 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x949e24 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x949e24 c_parse_file()
../../gcc/gcc/cp/parser.c:39029
0xa49bb6 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85264] New: [7/8 Regression] ICE with extraneous template parameter list

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85264

Bug ID: 85264
   Summary: [7/8 Regression] ICE with extraneous template
parameter list
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Keywords: accepts-invalid, 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 {};

template
template struct A<void(T...)> {};

A<void(int)> a;
=

bug.cc: In substitution of 'template > template
struct A<void(T ...)> [with T = ; int  = {int}]':
bug.cc:6:14:   required from here
bug.cc:6:14: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:11875
 A<void(int)> a;
  ^
0x644533 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11875
0x96952a tsubst_arg_types
../../gcc/gcc/cp/pt.c:13549
0x96973d tsubst_function_type
../../gcc/gcc/cp/pt.c:13711
0x96a1c3 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:14440
0x979422 tsubst_template_args
../../gcc/gcc/cp/pt.c:12137
0x96a855 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:14301
0x986c57 get_partial_spec_bindings
../../gcc/gcc/cp/pt.c:22385
0x987176 most_specialized_partial_spec
../../gcc/gcc/cp/pt.c:22618
0x99107f instantiate_class_template_1
../../gcc/gcc/cp/pt.c:10567
0x99107f instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:11100
0x9d8b6d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:136
0x885e67 start_decl_1(tree_node*, bool)
../../gcc/gcc/cp/decl.c:5275
0x8ac107 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/gcc/cp/decl.c:5238
0x93d1b3 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19610
0x944988 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13049
0x945798 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x949722 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12772
0x949b31 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x949e24 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x949e24 c_parse_file()
../../gcc/gcc/cp/parser.c:39029
Please submit a full bug report, [etc.]

Before, the code was wrongly accepted.
If I use regular template parameters instead of parameter packs, the code
is also wrongly accepted (since at least GCC 3.1.1).

[Bug c++/85263] New: [concepts] ICE with parameter pack matching

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85263

Bug ID: 85263
   Summary: [concepts] ICE with parameter pack matching
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

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

===
template<typename..., int...> concept bool C = true;

C{A, B} void foo();
===

bug.cc:3:3: error: cannot match pack for introduced parameter
 C{A, B} void foo();
   ^
bug.cc:3:7: internal compiler error: tree check: accessed elt 1 of tree_vec
with 0 elts in process_introduction_parm, at cp/constraint.cc:1325
 C{A, B} void foo();
   ^
0x78f405 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../gcc/gcc/tree.c:9520
0x5e94ec tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
../../gcc/gcc/tree.h:3356
0x5e94ec process_introduction_parm
../../gcc/gcc/cp/constraint.cc:1325
0x5e94ec finish_template_introduction(tree_node*, tree_node*)
../../gcc/gcc/cp/constraint.cc:1408
0x944368 cp_parser_template_introduction
../../gcc/gcc/cp/parser.c:27066
0x944368 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:27170
0x949714 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12767
0x949b31 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x949e24 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x949e24 c_parse_file()
../../gcc/gcc/cp/parser.c:39029
0xa49bb6 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85262] New: [6/7/8 Regression] Trouble with constructor and -fpermissive

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85262

Bug ID: 85262
   Summary: [6/7/8 Regression] Trouble with constructor and
-fpermissive
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code, rejects-valid
  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 "-fpermissive")
triggers an ICE on trunk:


struct A {};

template struct B : A
{
  B()
  {
A::A(A());
  }
};

B<0> b;


bug.cc: In constructor 'B< >::B()':
bug.cc:7:13: warning: cannot call constructor 'A::A' directly [-fpermissive]
 A::A(A());
 ^
bug.cc:7:13: note: for a function-style cast, remove the redundant '::A'
bug.cc: In instantiation of 'B< >::B() [with int  = 0]':
bug.cc:11:6:   required from here
bug.cc:7:10: internal compiler error: in tsubst_copy, at cp/pt.c:15625
 A::A(A());
  ^~~
0x63a8eb tsubst_copy
../../gcc/gcc/cp/pt.c:15625
0x96682b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18658
0x967f8c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18295
0x965a11 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17543
0x971627 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17099
0x97092e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16300
0x96e71f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16583
0x97005c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16286
0x96e71f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16583
0x96d8b8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16271
0x96d8b8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:23682
0x99476b instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:23798
0x8b8e3b c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4725
Please submit a full bug report, [etc.]

In GCC 6 and GCC 7 the code is wrongly rejected (when parsing the template,
the call to A::A is accepted with "-fpermissive", but at instantiation time
it is rejected) while a version without template compiles:

bug.cc: In constructor 'B< >::B()':
bu5.cc:7:13: warning: cannot call constructor 'A::A' directly [-fpermissive]
 A::A(A());
 ^
bug.cc:7:13: note: for a function-style cast, remove the redundant '::A'
bug.cc: In instantiation of 'B< >::B() [with int  = 0]':
bug.cc:11:6:   required from here
bug.cc:7:9: error: cannot call constructor 'A::A' directly
 A::A(A());
 ^

[Bug c++/85258] New: [7/8 Regression] ICE with invalid range-based for-loop

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85258

Bug ID: 85258
   Summary: [7/8 Regression] ICE with invalid range-based for-loop
   Product: gcc
   Version: 8.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 void foo()
{
  int x[8];
  for (int& i, j : x)
i = 0;
}

void bar()
{
  foo<0>();
}


bug.cc: In function 'void foo()':
bug.cc:4:14: error: multiple declarations in range-based 'for' loop
   for (int& i, j : x)
  ^
bug.cc: In instantiation of 'void foo() [with int  = 0]':
bug.cc:10:10:   required from here
bug.cc:5:5: internal compiler error: Segmentation fault
 i = 0;
 ^
0xebd87f crash_signal
../../gcc/gcc/toplev.c:325
0x85245d reduced_constant_expression_p(tree_node*)
../../gcc/gcc/cp/constexpr.c:1776
0x964822 tsubst_copy
../../gcc/gcc/cp/pt.c:15142
0x9654ef tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:18526
0x966768 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17467
0x965a96 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17771
0x971627 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:17099
0x97092e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16300
0x970f2c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16495
0x97005c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16286
0x96e71f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16583
0x96d8b8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16271
0x96d8b8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:23682
0x99476b instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:23798
0x8b8e3b c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4725
Please submit a full bug report, [etc.]

[Bug c++/85256] New: [8 Regression] ICE with capturing pointer to VLA

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85256

Bug ID: 85256
   Summary: [8 Regression] ICE with capturing pointer to VLA
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following code snippet triggers an ICE on trunk:

=
void foo(int i)
{
  int (*x)[i];
  [=]{ [=]{ 0 ? x : x; }; };
}
=

bug.cc: In lambda function:
bug.cc:4:17: error: capture of variable-size type 'int (*)[i]' that is not an
N3639 array of runtime bound
   [=]{ [=]{ 0 ? x : x; }; };
 ^
bug.cc:4:21: error: capture of variable-size type 'int (*)[i]' that is not an
N3639 array of runtime bound
   [=]{ [=]{ 0 ? x : x; }; };
 ^
bug.cc: In lambda function:
bug.cc:4:24: internal compiler error: in insert_capture_proxy, at
cp/lambda.c:319
   [=]{ [=]{ 0 ? x : x; }; };
^
0x615c84 insert_capture_proxy(tree_node*)
../../gcc/gcc/cp/lambda.c:319
0x8dbd9e insert_pending_capture_proxies()
../../gcc/gcc/cp/lambda.c:354
0x9260da cp_parser_lambda_expression
../../gcc/gcc/cp/parser.c:10212
0x9260da cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:5263
0x938d7c cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7022
0x939950 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8314
0x91974f cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:9082
0x919f5a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9183
0x91b794 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9478
0x91bea8 cp_parser_expression
../../gcc/gcc/cp/parser.c:9647
0x91db88 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:11123
0x923fcd cp_parser_statement
../../gcc/gcc/cp/parser.c:10927
0x925530 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11266
0x926007 cp_parser_lambda_body
../../gcc/gcc/cp/parser.c:10677
0x926007 cp_parser_lambda_expression
../../gcc/gcc/cp/parser.c:10178
0x926007 cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:5263
0x938d7c cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7022
0x939950 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8314
0x91974f cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:9082
0x919f5a cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:9183
Please submit a full bug report, [etc.]

The regression was introduced between 2017-10-07 and 2017-10-13.

I'm not sure whether the code is indeed invalid as the error messages suggest.
The code is accepted by GCC 4.5 - 4.8.
The code is accepted, if I use "int x[i]" instead of "int (*x)[i]".
And clang 3.6 - 5.0 accepts the code.

[Bug c++/85006] [7 Regression] [concepts] ICE with bogus parameter pack

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85006

Volker Reichelt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Volker Reichelt  ---
Fixed by Jason's patch.

[Bug c++/85249] New: [6/7/8 Regression] ICE with invalid default parameter

2018-04-06 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85249

Bug ID: 85249
   Summary: [6/7/8 Regression] ICE with invalid default parameter
   Product: gcc
   Version: 8.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.8.0:


struct A
{
  void operator= (const A& = A());
  void foo(const A&);
};

void A::foo(const A& = A()) {}


bug.cc:3:33: error: 'void A::operator=(const A&)' cannot have default arguments
   void operator= (const A& = A());
 ^
bug.cc:7:27: internal compiler error: canonical types differ for identical
types 'void (A::)(const A&)' and 'void (A::)(const A&)'
 void A::foo(const A& = A()) {}
   ^
0x9dc198 comptypes(tree_node*, tree_node*, int)
../../gcc/gcc/cp/typeck.c:1480
0x89241a duplicate_decls(tree_node*, tree_node*, bool)
../../gcc/gcc/cp/decl.c:2226
0x899062 grokfndecl
../../gcc/gcc/cp/decl.c:9099
0x8a95f0 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
../../gcc/gcc/cp/decl.c:12429
0x8ac476 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
../../gcc/gcc/cp/decl.c:15299
0x93c891 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:26711
0x93c891 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19501
0x944508 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13049
0x945318 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x9492a2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12772
0x9496b1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x9499a4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9499a4 c_parse_file()
../../gcc/gcc/cp/parser.c:39016
0xa49636 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

[Bug c++/85242] New: [6/7/8 Regression] ICE with invalid template parameter

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85242

Bug ID: 85242
   Summary: [6/7/8 Regression] ICE with invalid template parameter
   Product: gcc
   Version: 8.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
  Target Milestone: ---

The following invalid code snippet triggers an ICE on trunk since GCC 6.1.0:

==
namespace N
{
  struct A {};
}

template void foo();
==

'
in dump_template_decl, at cp/error.c:1305
 template void foo();
^
0x7163e0 dump_template_decl
../../gcc-6.1.0/gcc/cp/error.c:1305
0x718bf2 decl_to_string
../../gcc-6.1.0/gcc/cp/error.c:2955
0x718bf2 cp_printer
../../gcc-6.1.0/gcc/cp/error.c:3535
0x14b50b8 pp_format(pretty_printer*, text_info*)
../../gcc-6.1.0/gcc/pretty-print.c:631
0x14b0928 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gcc-6.1.0/gcc/diagnostic.c:823
0x14b17ed error(char const*, ...)
../../gcc-6.1.0/gcc/diagnostic.c:1152
0x644646 duplicate_decls(tree_node*, tree_node*, bool)
../../gcc-6.1.0/gcc/cp/decl.c:1609
0x81664c pushdecl_maybe_friend_1
../../gcc-6.1.0/gcc/cp/name-lookup.c:805
0x81664c pushdecl_maybe_friend(tree_node*, bool)
../../gcc-6.1.0/gcc/cp/name-lookup.c:1298
0x819753 pushdecl_with_scope_1
../../gcc-6.1.0/gcc/cp/name-lookup.c:2295
0x81983c pushdecl_with_scope(tree_node*, cp_binding_level*, bool)
../../gcc-6.1.0/gcc/cp/name-lookup.c:2309
0x8198ef pushdecl_namespace_level(tree_node*, bool)
../../gcc-6.1.0/gcc/cp/name-lookup.c:3915
0x6b5e30 push_template_decl_real(tree_node*, bool)
../../gcc-6.1.0/gcc/cp/pt.c:5392
0x72f2da cp_parser_class_head
../../gcc-6.1.0/gcc/cp/parser.c:21951
0x72f2da cp_parser_class_specifier_1
../../gcc-6.1.0/gcc/cp/parser.c:21285
0x72f2da cp_parser_class_specifier
../../gcc-6.1.0/gcc/cp/parser.c:21582
0x72f2da cp_parser_type_specifier
../../gcc-6.1.0/gcc/cp/parser.c:15836
0x743571 cp_parser_decl_specifier_seq
../../gcc-6.1.0/gcc/cp/parser.c:12760
0x7451e6 cp_parser_parameter_declaration
../../gcc-6.1.0/gcc/cp/parser.c:20437
0x7467e9 cp_parser_template_parameter
../../gcc-6.1.0/gcc/cp/parser.c:14543
Please submit a full bug report, [etc.]

Note that the compiler even fails to properly emit the
"internal compiler error" message.
GCC 4.4 - GCC 5 wrongly accepted the code.

[Bug c++/85240] New: [6/7/8 Regression] ICE with function without deduced return type

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85240

Bug ID: 85240
   Summary: [6/7/8 Regression] ICE with function without deduced
return type
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code, lto
  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 "-flto") triggers an ICE
since GCC 5.1.0:

=
auto foo();

void bar()
{
  using ::foo;
}
=

during IPA pass: fnsummary
bug.cc:6:1: internal compiler error: tree code 'template_type_parm' is not
supported in LTO streams
 }
 ^
0xd8e523 lto_write_tree
../../gcc/gcc/lto-streamer-out.c:442
0xd8e523 lto_output_tree_1
../../gcc/gcc/lto-streamer-out.c:483
0xd8e523 DFS::DFS(output_block*, tree_node*, bool, bool, bool)
../../gcc/gcc/lto-streamer-out.c:670
0xd8f42d lto_output_tree(output_block*, tree_node*, bool, bool)
../../gcc/gcc/lto-streamer-out.c:1642
0xd84b92 write_global_stream
../../gcc/gcc/lto-streamer-out.c:2492
0xd8d3ee lto_output_decl_state_streams(output_block*, lto_out_decl_state*)
../../gcc/gcc/lto-streamer-out.c:2539
0xd8d3ee produce_asm_for_decls()
../../gcc/gcc/lto-streamer-out.c:2872
0xdeb49f write_lto
../../gcc/gcc/passes.c:2613
0xdeeb8e ipa_write_summaries_1
../../gcc/gcc/passes.c:2674
0xdeeb8e ipa_write_summaries()
../../gcc/gcc/passes.c:2734
0xaf2a52 ipa_passes
../../gcc/gcc/cgraphunit.c:2468
0xaf2a52 symbol_table::compile()
../../gcc/gcc/cgraphunit.c:2558
0xaf4a89 symbol_table::compile()
../../gcc/gcc/cgraphunit.c:2537
0xaf4a89 symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2717
Please submit a full bug report, [etc.]

[Bug c++/84979] [6/7 Regression] ICE with auto as template parameter and -fconcepts

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84979

--- Comment #5 from Volker Reichelt  ---
*** Bug 85064 has been marked as a duplicate of this bug. ***

[Bug c++/67491] [meta-bug] concepts issues

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 85064, which changed state.

Bug 85064 Summary: [concepts] ICE with auto as template parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85064

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

[Bug c++/85064] [concepts] ICE with auto as template parameter

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85064

Volker Reichelt  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Volker Reichelt  ---
Duplicate of 84979, fixed on trunk by Alexandre's patch.

*** This bug has been marked as a duplicate of bug 84979 ***

[Bug c++/85229] New: .[concepts] ICE with local class in lambda

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85229

Bug ID: 85229
   Summary: .[concepts] ICE with local class in lambda
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

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

=
template concept bool C = []
{
  struct A
  {
C{T} void foo();
  };
};
=

bug.cc: In lambda function:
bug.cc:5:20: internal compiler error: in check_member_template, at
cp/decl2.c:573
 C{T} void foo();
^
0x8b06cb check_member_template(tree_node*)
../../gcc/gcc/cp/decl2.c:573
0x94e5c4 finish_member_template_decl(tree_node*)
../../gcc/gcc/cp/pt.c:307
0x943832 cp_parser_template_declaration_after_parameters
../../gcc/gcc/cp/parser.c:26911
0x9440a6 cp_parser_template_introduction
../../gcc/gcc/cp/parser.c:27056
0x9440a6 cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:27157
0x92e583 cp_parser_member_declaration
../../gcc/gcc/cp/parser.c:23467
0x92f7fa cp_parser_member_specification_opt
../../gcc/gcc/cp/parser.c:23389
0x92f7fa cp_parser_class_specifier_1
../../gcc/gcc/cp/parser.c:22521
0x9318f9 cp_parser_class_specifier
../../gcc/gcc/cp/parser.c:22783
0x9318f9 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:16766
0x93ec56 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13617
0x944370 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12927
0x945318 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x945d49 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:12468
0x9241c3 cp_parser_statement
../../gcc/gcc/cp/parser.c:10917
0x925130 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11266
0x925c07 cp_parser_lambda_body
../../gcc/gcc/cp/parser.c:10677
0x925c07 cp_parser_lambda_expression
../../gcc/gcc/cp/parser.c:10178
0x925c07 cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:5263
0x93894c cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:7022
Please submit a full bug report, [etc.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85228] New: [8 Regression] ICE with constexpr lambda in template

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85228

Bug ID: 85228
   Summary: [8 Regression] ICE with constexpr lambda in template
   Product: gcc
   Version: 8.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 "-std=c++1z") triggers
an ICE on trunk:

===
template struct A
{
  enum E { e = []{ return 0; }() };
};

template class A<0>;
===

bug.cc:6:16: internal compiler error: Segmentation fault
 template class A<0>;
^~~~
0xebd2ff crash_signal
../../gcc/gcc/toplev.c:325
0x990601 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3134
0x990601 bt_instantiate_type_proc
../../gcc/gcc/cp/pt.c:22826
0x8fe237 binding_table_foreach(binding_table_s*, void (*)(binding_entry_s*,
void*), void*)
../../gcc/gcc/cp/name-lookup.c:1936
0x990423 do_type_instantiation(tree_node*, tree_node*, int)
../../gcc/gcc/cp/pt.c:22970
0x94290f cp_parser_explicit_instantiation
../../gcc/gcc/cp/parser.c:16543
0x949361 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12724
0x9496b1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x9499a4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9499a4 c_parse_file()
../../gcc/gcc/cp/parser.c:39016
0xa49636 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

The regression was introduced between 2017-08-19 and 2017-09-02.
Before, the code was wrongly rejected:

bug.cc:3:32: error: expression '' is not a constant expression
   enum E { e = []{ return 0; }() };
^

[Bug c++/85227] New: ICE with structured binding of a forward declared variable

2018-04-05 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85227

Bug ID: 85227
   Summary: ICE with structured binding of a forward declared
variable
   Product: gcc
   Version: 8.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
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++17") triggers
an ICE since GCC 7.1.0 (when structured bindings were introduced):

===
extern struct A a;

template void foo()
{
  auto[i] = a;
}
===

bug.cc: In function 'void foo()':
bug.cc:5:13: internal compiler error: Segmentation fault
   auto[i] = a;
 ^
0xebd2ff crash_signal
../../gcc/gcc/toplev.c:325
0x881861 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3134
0x881861 find_decomp_class_base
../../gcc/gcc/cp/decl.c:7344
0x8a3ec4 cp_finish_decomp(tree_node*, tree_node*, unsigned int)
../../gcc/gcc/cp/decl.c:7733
0x944963 cp_parser_decomposition_declaration
../../gcc/gcc/cp/parser.c:13336
0x944963 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12979
0x945318 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x945d49 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:12468
0x9241c3 cp_parser_statement
../../gcc/gcc/cp/parser.c:10917
0x925130 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11266
0x925207 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11220
0x93bde0 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21781
0x93bde0 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21818
0x93c690 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26839
0x93d416 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:26755
0x93d416 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19501
0x94362a cp_parser_single_declaration
../../gcc/gcc/cp/parser.c:27295
0x94376c cp_parser_template_declaration_after_parameters
../../gcc/gcc/cp/parser.c:26897
0x94402c cp_parser_explicit_template_declaration
../../gcc/gcc/cp/parser.c:27134
0x94402c cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:27153
Please submit a full bug report, [etc.]

[Bug c++/81575] [7/8 Regression] ICE on C++ code: in cp_build_addr_expr_1, at cp/typeck.c:5793

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81575

Volker Reichelt  changed:

   What|Removed |Added

  Known to fail|8.0 |7.3.0

--- Comment #7 from Volker Reichelt  ---
Jason, this got fixed on trunk by your fix for PR85141.
Do you want to add any testcases from this bug?

[Bug c++/85210] New: ICE with broken structured binding in template

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85210

Bug ID: 85210
   Summary: ICE with broken structured binding in template
   Product: gcc
   Version: 8.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 (compiled with "-std=c++1z") triggers
an ICE since GCC 7.1.0 (structured bindings were introduced):


struct A { int i; };

template void foo(int j)
{
  auto [j] = A{j};
}

void bar()
{
  foo<0>(0);
}


bug.cc: In function 'void foo(int)':
bug.cc:5:10: error: declaration of 'auto j' shadows a parameter
   auto [j] = A{j};
  ^
bug.cc: In instantiation of 'void foo(int) [with int  = 0]':
bug.cc:10:11:   required from here
bug.cc:5:8: internal compiler error: in fit_decomposition_lang_decl, at
cp/lex.c:724
   auto [j] = A{j};
^~~
0x61802a fit_decomposition_lang_decl(tree_node*, tree_node*)
../../gcc/gcc/cp/lex.c:724
0x8a2868 cp_finish_decomp(tree_node*, tree_node*, unsigned int)
../../gcc/gcc/cp/decl.c:7545
0x9746fd tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16409
0x96f15f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16561
0x96e2f8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16249
0x96e2f8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:23659
0x9932db instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:23775
0x8b893b c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4724
Please submit a full bug report, [etc.]

[Bug c++/85209] New: [8 Regression] ICE with lambda and structured binding

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85209

Bug ID: 85209
   Summary: [8 Regression] ICE with lambda and structured binding
   Product: gcc
   Version: 8.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
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++17") triggers
an ICE on trunk:

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

void bar()
{
  foo<0>();
}
===

bug.cc: In instantiation of 'void foo() [with int  = 0]':
bug.cc:8:10:   required from here
bug.cc:3:8: internal compiler error: in tsubst_decomp_names, at cp/pt.c:16223
   auto [a] = []{};
^~~
0x6456bb tsubst_decomp_names
../../gcc/gcc/cp/pt.c:16223
0x974695 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16403
0x971764 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16264
0x96f15f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16561
0x96e2f8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16249
0x96e2f8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:23659
0x9932db instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:23775
0x8b893b c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4724
Please submit a full bug report, [etc.]

The regression was introduced between 2017-08-19 and 2017-09-02.
Before, the code was correctly rejected:

bug.cc: In instantiation of 'void foo() [with int  = 0]':
bug.cc:8:10:   required from here
bug.cc:3:8: error: cannot decompose lambda closure type 'foo() [with int
 = 0]::<lambda()>'
   auto [a] = []{};
^~~

[Bug c++/85208] New: ICE with #pragma weak and structured binding

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85208

Bug ID: 85208
   Summary: ICE with #pragma weak and structured binding
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  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 "-std=c++17") triggers
an ICE since GCC 7.1.0 (when structured bindings were introduced):

==
#pragma weak foo

struct A { int i; };

auto [a] = A();
==

bug.cc:5:6: internal compiler error: in write_unqualified_name, at
cp/mangle.c:1338
 auto [a] = A();
  ^~~
0x619dda write_unqualified_name
../../gcc/gcc/cp/mangle.c:1338
0x8e61a7 write_name
../../gcc/gcc/cp/mangle.c:937
0x8e5986 write_encoding
../../gcc/gcc/cp/mangle.c:825
0x8ea224 mangle_decl_string
../../gcc/gcc/cp/mangle.c:3792
0x8f0070 get_mangled_id
../../gcc/gcc/cp/mangle.c:3814
0x8f0070 mangle_decl(tree_node*)
../../gcc/gcc/cp/mangle.c:3852
0x1147c4d decl_assembler_name(tree_node*)
../../gcc/gcc/tree.c:687
0xa4cfdc maybe_apply_pragma_weak(tree_node*)
../../gcc/gcc/c-family/c-pragma.c:291
0x8abea4 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/gcc/cp/decl.c:5094
0x94466d cp_parser_decomposition_declaration
../../gcc/gcc/cp/parser.c:13262
0x94466d cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12979
0x945218 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12874
0x9491a2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12772
0x9495b1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12648
0x9498a4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9498a4 c_parse_file()
../../gcc/gcc/cp/parser.c:39016
0xa494d6 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

[Bug c++/79627] Ice with type of VLA in lambda

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79627

Volker Reichelt  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-04-04
 CC||reichelt at gcc dot gnu.org
 Ever confirmed|0   |1
  Known to fail||4.5.0, 4.6.0, 4.7.0, 4.8.0,
   ||5.1.0, 6.1.0, 7.1.0, 8.0

[Bug c++/71174] [concepts] Segmentation fault while processing concepts error

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71174

Volker Reichelt  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code,
   ||memory-hog
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-04-04
 CC||reichelt at gcc dot gnu.org
 Blocks||67491
 Ever confirmed|0   |1
  Known to fail||8.0

--- Comment #5 from Volker Reichelt  ---
Confirmed.
To me it looks as if the self-referencing concept causes a stack-overflow.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85194] New: ICE with structured binding in broken for-loop

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85194

Bug ID: 85194
   Summary: ICE with structured binding in broken for-loop
   Product: gcc
   Version: 8.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 (compiled with "-std=c++17") triggers
an ICE since GCC 7.1.0 (when structured bindings were introduced):


struct A { int i; };

A x[2];

void foo()
{
  for (auto [i] = A() : x)
;
}


bug.cc: In function 'void foo()':
bug.cc:7:17: error: initializer in range-based 'for' loop
   for (auto [i] = A() : x)
 ^
bug.cc:7:23: internal compiler error: Segmentation fault
   for (auto [i] = A() : x)
   ^
0xebccdf crash_signal
../../gcc/gcc/toplev.c:325
0x91bd07 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
../../gcc/gcc/tree.h:3172
0x91bd07 cp_parser_range_for
../../gcc/gcc/cp/parser.c:11755
0x946866 cp_parser_for
../../gcc/gcc/cp/parser.c:11685
0x946866 cp_parser_iteration_statement
../../gcc/gcc/cp/parser.c:12242
0x923d06 cp_parser_statement
../../gcc/gcc/cp/parser.c:10824
0x924d10 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11276
0x924de7 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11230
0x93ba20 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21791
0x93ba20 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21828
0x93c2d0 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26849
0x93d056 cp_parser_function_definition_from_specifiers_and_declarator
../../gcc/gcc/cp/parser.c:26765
0x93d056 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19511
0x944148 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13059
0x944f58 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x948ee2 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12782
0x9492f1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12658
0x9495e4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9495e4 c_parse_file()
../../gcc/gcc/cp/parser.c:39026
0xa491c6 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

[Bug c++/83217] Compiler segfault: structured binding by reference to a templated type via a pointer

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83217

Volker Reichelt  changed:

   What|Removed |Added

 CC||antanubis at gmail dot com

--- Comment #6 from Volker Reichelt  ---
*** Bug 83481 has been marked as a duplicate of this bug. ***

[Bug c++/83481] ICE in const-ref structured bindings.

2018-04-04 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83481

Volker Reichelt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||reichelt at gcc dot gnu.org
  Known to work||7.3.0
 Resolution|--- |DUPLICATE
   Target Milestone|--- |7.3
  Known to fail||7.1.0

--- Comment #3 from Volker Reichelt  ---
Let's mark it as duplicate of PR83217, because it's fixed by the corresponding
patch.

*** This bug has been marked as a duplicate of bug 83217 ***

[Bug c++/85148] New: [6/7/8 Regression] ICE with NSDMI and this pointer

2018-03-31 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85148

Bug ID: 85148
   Summary: [6/7/8 Regression] ICE with NSDMI and this pointer
   Product: gcc
   Version: 8.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 5.1.0
(it was wrongly rejected in GCC 4.9.4):

=
template struct A
{
  T x[1]{(__PTRDIFF_TYPE__)this};
};

void foo()
{
  A<A<__PTRDIFF_TYPE__>> a{};
}
=

bug.cc: In function 'void foo()':
bug.cc:8:28: internal compiler error: in replace_placeholders_r, at
cp/tree.c:3148
   A<A<__PTRDIFF_TYPE__>> a{};
^
0x667871 replace_placeholders_r
../../gcc/gcc/cp/tree.c:3148
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x9d03b0 replace_placeholders_r
../../gcc/gcc/cp/tree.c:3188
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x9d03b0 replace_placeholders_r
../../gcc/gcc/cp/tree.c:3188
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x9d03b0 replace_placeholders_r
../../gcc/gcc/cp/tree.c:3188
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x9d03b0 replace_placeholders_r
../../gcc/gcc/cp/tree.c:3188
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x9d51d1 replace_placeholders(tree_node*, tree_node*, bool*)
../../gcc/gcc/cp/tree.c:3226
0x9f4bb3 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
../../gcc/gcc/cp/typeck2.c:851
0x887daa check_initializer
../../gcc/gcc/cp/decl.c:6469
0x89ffdc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/gcc/cp/decl.c:7127
0x93c97b cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19741
0x943e28 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:13059
0x944c38 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x945669 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:12478
0x923a73 cp_parser_statement
../../gcc/gcc/cp/parser.c:10927
0x9249e0 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11276
Please submit a full bug report, [etc.]

[Bug c++/85147] New: [6/7/8 Regression] ICE with invalid variadic template-template parameter

2018-03-31 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85147

Bug ID: 85147
   Summary: [6/7/8 Regression] ICE with invalid variadic
template-template parameter
   Product: gcc
   Version: 8.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 6.1.0:


template struct A
{
  template<template<...T> class...> struct B {};
};

A::B<> b;


bug.cc:3:21: error: expected identifier before '...' token
   template<template<...T> class...> struct B {};
 ^~~
bug.cc: In instantiation of 'struct A':
bug.cc:6:7:   required from here
bug.cc:3:44: internal compiler error: in fixed_parameter_pack_p_1, at
cp/pt.c:5113
   template<template<...T> class...> struct B {};
^
0x630249 fixed_parameter_pack_p_1
../../gcc/gcc/cp/pt.c:5113
0x94c1f9 fixed_parameter_pack_p_1
../../gcc/gcc/cp/pt.c:5117
0x95edc4 fixed_parameter_pack_p(tree_node*)
../../gcc/gcc/cp/pt.c:5144
0x9824ef coerce_template_parameter_pack
../../gcc/gcc/cp/pt.c:8067
0x9824ef coerce_template_parms
../../gcc/gcc/cp/pt.c:8377
0x986308 coerce_innermost_template_parms
../../gcc/gcc/cp/pt.c:8587
0x97b9b6 lookup_template_class_1
../../gcc/gcc/cp/pt.c:9032
0x97b9b6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:9381
0x97d48a tsubst_aggr_type
../../gcc/gcc/cp/pt.c:12315
0x977a2e tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13944
0x9815ad tsubst_template_decl
../../gcc/gcc/cp/pt.c:12849
0x97daef tsubst_decl
../../gcc/gcc/cp/pt.c:12970
0x977b2f tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13862
0x990c3a instantiate_class_template_1
../../gcc/gcc/cp/pt.c:10851
0x990c3a instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:11100
0x9d7b4d complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:136
0x9355aa cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6447
0x93e463 cp_parser_constructor_declarator_p
../../gcc/gcc/cp/parser.c:26539
0x93e463 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13616
0x943c90 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12937
Please submit a full bug report, [etc.]

[Bug c++/85146] New: ICE with __direct_bases for declared but not defined struct

2018-03-31 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85146

Bug ID: 85146
   Summary: ICE with __direct_bases for declared but not defined
struct
   Product: gcc
   Version: 8.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
CC: paolo.carlini at oracle dot com
  Target Milestone: ---

The following valid code snippet triggers an ICE since GCC 4.7.0
(when __direct_bases was introduced):

=
template struct A {};

template struct B
{
  typedef A<__direct_bases(T)...> C;
};

struct X;

B b;
=

bug.cc: In instantiation of 'struct B':
bug.cc:10:6:   required from here
bug.cc:5:35: internal compiler error: Segmentation fault
   typedef A<__direct_bases(T)...> C;
   ^
0xd0137f crash_signal
../../gcc-5.1.0/gcc/toplev.c:383
0x7d6e1d tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc-5.1.0/gcc/tree.h:2845
0x7d6e1d calculate_direct_bases(tree_node*)
../../gcc-5.1.0/gcc/cp/semantics.c:3745
0x6a7511 tsubst_pack_expansion
../../gcc-5.1.0/gcc/cp/pt.c:9973
0x6a8dba tsubst_template_args
../../gcc-5.1.0/gcc/cp/pt.c:10221
0x6a8b93 tsubst_template_args
../../gcc-5.1.0/gcc/cp/pt.c:10239
0x6bf2a0 tsubst_aggr_type
../../gcc-5.1.0/gcc/cp/pt.c:10454
0x6ab22a tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-5.1.0/gcc/cp/pt.c:11909
0x6c0886 tsubst_decl
../../gcc-5.1.0/gcc/cp/pt.c:11339
0x6ab786 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-5.1.0/gcc/cp/pt.c:11830
0x6e0381 instantiate_class_template_1
../../gcc-5.1.0/gcc/cp/pt.c:9424
0x6e0381 instantiate_class_template(tree_node*)
../../gcc-5.1.0/gcc/cp/pt.c:9688
0x77ac6b complete_type(tree_node*)
../../gcc-5.1.0/gcc/cp/typeck.c:146
0x657587 start_decl_1(tree_node*, bool)
../../gcc-5.1.0/gcc/cp/decl.c:4900
0x678887 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc-5.1.0/gcc/cp/decl.c:4863
0x76cfed cp_parser_init_declarator
../../gcc-5.1.0/gcc/cp/parser.c:17170
0x76f915 cp_parser_simple_declaration
../../gcc-5.1.0/gcc/cp/parser.c:11607
0x7693a3 cp_parser_block_declaration
../../gcc-5.1.0/gcc/cp/parser.c:11481
0x773249 cp_parser_declaration
../../gcc-5.1.0/gcc/cp/parser.c:11378
0x7718da cp_parser_declaration_seq_opt
../../gcc-5.1.0/gcc/cp/parser.c:11264
Please submit a full bug report, [etc.]

This is related to PR60218 where the same issue was solved
for __bases instead of __direct_bases. Paolo, you
fixed PR60218 for GCC 6. Would you mind having a look?

[Bug c++/85141] New: [6/7/8 Regression] ICE with pointer arithmetic of static member function address

2018-03-31 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85141

Bug ID: 85141
   Summary: [6/7/8 Regression] ICE with pointer arithmetic of
static member function address
   Product: gcc
   Version: 8.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 "-fpermissive")
triggers an ICE since GCC 4.7.0:

==
struct A
{
  static int foo();
};

void bar(int i)
{
  i += A().foo;
}
==

bug.cc: In function 'void bar(int)':
bug.cc:8:5: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   i += A().foo;
   ~~^~
bug.cc:8:12: warning: invalid conversion from 'int (*)()' to 'int'
[-fpermissive]
   i += A().foo;
^~~
bug.cc:8:5: internal compiler error: tree check: expected field_decl, have
baselink in component_ref_field_offset, at tree.c:12950
   i += A().foo;
   ~~^~
0x78c848 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9322
0x795d33 tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3135
0x795d33 component_ref_field_offset(tree_node*)
../../gcc/gcc/tree.c:12950
0xc6d027 gimplify_compound_lval
../../gcc/gcc/gimplify.c:2936
0xc65372 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11386
0xc74ff3 gimplify_modify_expr
../../gcc/gcc/gimplify.c:5625
0xc666f0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11434
0xc735de gimplify_target_expr
../../gcc/gcc/gimplify.c:6576
0xc668ed gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11815
0xc697f6 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc6a179 gimplify_compound_expr
../../gcc/gcc/gimplify.c:5885
0xc6f74a gimplify_modify_expr_rhs
../../gcc/gcc/gimplify.c:5225
0xc74f3a gimplify_modify_expr_rhs
../../gcc/gcc/gimplify.c:5125
0xc74f3a gimplify_modify_expr
../../gcc/gcc/gimplify.c:5580
0xc666f0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11434
0xc697f6 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc67692 gimplify_cleanup_point_expr
../../gcc/gcc/gimplify.c:6399
0xc67692 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11811
0xc697f6 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc6b1ea gimplify_body(tree_node*, bool)
../../gcc/gcc/gimplify.c:12635
Please submit a full bug report, [etc.]


If I add the option "-fsanitize=undefined" I get a different stack trace:

bug.cc: In function 'void bar(int)':
bug.cc:8:5: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   i += A().foo;
   ~~^~
bug.cc:8:12: warning: invalid conversion from 'int (*)()' to 'int'
[-fpermissive]
   i += A().foo;
^~~
bug.cc:8:1: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'baselink' in
cp_ubsan_maybe_instrument_member_access, at cp/cp-ubsan.c:154
 }
 ^
0x78d0a7 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../gcc/gcc/tree.c:9494
0x5eee6d contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3249
0x5eee6d cp_ubsan_maybe_instrument_member_access
../../gcc/gcc/cp/cp-ubsan.c:154
0x5eee6d cp_ubsan_check_member_access_r
../../gcc/gcc/cp/cp-ubsan.c:213
0x116564b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11387
0x11659c6 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc/gcc/tree.c:11613
0x1165d6f walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*

[Bug c++/85140] New: ICE with invalid use of alignas

2018-03-31 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85140

Bug ID: 85140
   Summary: ICE with invalid use of alignas
   Product: gcc
   Version: 8.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 coide snippet triggers an ICE since GCC 4.8.0:

=
namespace N alignas() {}
=

bug.cc:1:21: error: expected primary-expression before ')' token
 namespace N alignas() {}
 ^
bug.cc:1:24: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:835
 namespace N alignas() {}
^
0x78c848 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9322
0x9fa8a5 tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3391
0x9fa8a5 get_attribute_name(tree_node const*)
../../gcc/gcc/attribs.c:835
0x8ffbad handle_namespace_attrs(tree_node*, tree_node*)
../../gcc/gcc/cp/name-lookup.c:5049
0x9496bf cp_parser_namespace_definition
../../gcc/gcc/cp/parser.c:18585
0x948cd3 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12762
0x948fd1 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12658
0x9492c4 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:4563
0x9492c4 c_parse_file()
../../gcc/gcc/cp/parser.c:39024
0xa48b26 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

[Bug c++/85137] New: [concepts] ICE with undeclared concept

2018-03-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85137

Bug ID: 85137
   Summary: [concepts] ICE with undeclared concept
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

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

==
template<template requires C class> struct A {};

template requires true struct B {};

A a;
==

bug.cc:1:38: error: 'C' was not declared in this scope
 template<template requires C class> struct A {};
  ^
bug.cc:5:4: internal compiler error: in non_atomic_constraint_p, at
cp/logic.cc:318
 A a;
^
0x617ec5 non_atomic_constraint_p
../../gcc/gcc/cp/logic.cc:318
0x8e36e0 any_p<std::_List_iterator<tree_node*>, bool (*)(tree_node*)>
../../gcc/gcc/cp/logic.cc:67
0x8e36e0 any_non_atomic_constraints_p
../../gcc/gcc/cp/logic.cc:327
0x8e36e0 analyze_atom
../../gcc/gcc/cp/logic.cc:359
0x8e36e0 analyze_term
../../gcc/gcc/cp/logic.cc:468
0x8e36e0 check_term
../../gcc/gcc/cp/logic.cc:495
0x8e28df check_goal
../../gcc/gcc/cp/logic.cc:511
0x8e28df check_proof
../../gcc/gcc/cp/logic.cc:537
0x8e28df prove_implication
../../gcc/gcc/cp/logic.cc:754
0x8e3499 prove_implication
../../gcc/gcc/cp/logic.cc:731
0x8e3499 subsumes_constraints_nonnull
../../gcc/gcc/cp/logic.cc:786
0x8e3499 subsumes(tree_node*, tree_node*)
../../gcc/gcc/cp/logic.cc:803
0x98488b is_compatible_template_arg
../../gcc/gcc/cp/pt.c:7705
0x98488b convert_template_argument
../../gcc/gcc/cp/pt.c:7944
0x982893 coerce_template_parms
../../gcc/gcc/cp/pt.c:8480
0x97ba36 lookup_template_class_1
../../gcc/gcc/cp/pt.c:9032
0x97ba36 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:9381
0x9ac5bd finish_template_type(tree_node*, tree_node*, int)
../../gcc/gcc/cp/semantics.c:3227
0x928784 cp_parser_template_id
../../gcc/gcc/cp/parser.c:15852
0x92888e cp_parser_class_name
../../gcc/gcc/cp/parser.c:22383
Please submit a full bug report, [etc.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85136] New: ICE with array as template variable

2018-03-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85136

Bug ID: 85136
   Summary: ICE with array as template variable
   Product: gcc
   Version: 8.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 5.1.0
(when variable templates were introduced):


enum { e };

template const int x[] = { [e] = 0 };


bug.cc:3:41: internal compiler error: tree check: expected integer_cst, have
nop_expr in get_len, at tree.h:5572
 template const int x[] = { [e] = 0 };
 ^
0x78c8a6 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9322
0x67da95 tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3391
0x67da95 wi::extended_tree<192>::get_len() const
../../gcc/gcc/tree.h:5572
0x67da95 wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<192> >
const&)
../../gcc/gcc/wide-int.h:934
0x67da95 wide_int_ref_storage<true,
false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
../../gcc/gcc/wide-int.h:983
0x67da95 generic_wide_int<wide_int_ref_storage<true, false>
>::generic_wide_int<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
../../gcc/gcc/wide-int.h:758
0x67da95 bool wi::lts_p<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
../../gcc/gcc/wide-int.h:1849
0x67da95 wi::binary_traits<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >,
wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type,
wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::precision_type>::signed_predicate_result operator<
<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
../../gcc/gcc/wide-int.h:3170
0x67da95 tree_int_cst_lt(tree_node const*, tree_node const*)
../../gcc/gcc/tree.h:5728
0x67da95 complete_array_type(tree_node**, tree_node*, bool)
../../gcc/gcc/c-family/c-common.c:6363
0x887821 cp_complete_array_type(tree_node**, tree_node*, bool)
../../gcc/gcc/cp/decl.c:8369
0x887a4e maybe_deduce_size_from_array_init
../../gcc/gcc/cp/decl.c:5474
0x8a047c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/gcc/cp/decl.c:7030
0x93c9fb cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:19741
0x942fca cp_parser_single_declaration
../../gcc/gcc/cp/parser.c:27303
0x94310c cp_parser_template_declaration_after_parameters
../../gcc/gcc/cp/parser.c:26905
0x9439cc cp_parser_explicit_template_declaration
../../gcc/gcc/cp/parser.c:27142
0x9439cc cp_parser_template_declaration_after_export
../../gcc/gcc/cp/parser.c:27161
0x948d69 cp_parser_declaration
../../gcc/gcc/cp/parser.c:12731
0x949051 cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:12658
Please submit a full bug report, [etc.]

[Bug c++/85135] New: [7/8 Regression] ICE with invalid late-specified return type

2018-03-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85135

Bug ID: 85135
   Summary: [7/8 Regression] ICE with invalid late-specified
return type
   Product: gcc
   Version: 8.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
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++1z")
triggers an ICE since GCC 7.1.0:


template struct A {};

auto foo() -> A;

template struct B {};

auto foo() -> A;


bug.cc:7:15: internal compiler error: canonical types differ for identical
types A and A
 auto foo() -> A;
   ^
0x75c440 comptypes(tree_node*, tree_node*, int)
../../gcc-7.1.0/gcc/cp/typeck.c:1433
0x6229a8 decls_match(tree_node*, tree_node*)
../../gcc-7.1.0/gcc/cp/decl.c:1085
0x6232fc duplicate_decls(tree_node*, tree_node*, bool)
../../gcc-7.1.0/gcc/cp/decl.c:1409
0x810ee8 pushdecl_maybe_friend_1
../../gcc-7.1.0/gcc/cp/name-lookup.c:835
0x810ee8 pushdecl_maybe_friend(tree_node*, bool)
../../gcc-7.1.0/gcc/cp/name-lookup.c:1352
0x639635 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc-7.1.0/gcc/cp/decl.c:5137
0x722a07 cp_parser_init_declarator
../../gcc-7.1.0/gcc/cp/parser.c:19255
0x74718c cp_parser_simple_declaration
../../gcc-7.1.0/gcc/cp/parser.c:12777
0x747f25 cp_parser_block_declaration
../../gcc-7.1.0/gcc/cp/parser.c:12602
0x74d3d4 cp_parser_declaration
../../gcc-7.1.0/gcc/cp/parser.c:12500
0x74f00b cp_parser_declaration_seq_opt
../../gcc-7.1.0/gcc/cp/parser.c:12376
0x74f2ea cp_parser_translation_unit
../../gcc-7.1.0/gcc/cp/parser.c:4366
0x74f2ea c_parse_file()
../../gcc-7.1.0/gcc/cp/parser.c:38431
0x8b25e3 c_common_parse_file()
../../gcc-7.1.0/gcc/c-family/c-opts.c:1107
Please submit a full bug report, [etc.]

[Bug c++/85134] New: [8 Regression] ICE with invalid constexpr in 'shared' OpenMP clause

2018-03-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85134

Bug ID: 85134
   Summary: [8 Regression] ICE with invalid constexpr in 'shared'
OpenMP clause
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Keywords: error-recovery, ice-on-invalid-code, openmp
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
CC: jason at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet (compiled with "-fopenmp")
triggers an ICE on trunk.

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

#pragma omp parallel shared(x)
  ;
}
===

bug.cc: In function 'void foo(int)':
bug.cc:3:25: error: 'constexpr' variable 'x' has variably-modified type 'const
int [i]'
   constexpr int x[i] = {};
 ^
bug.cc:5:9: internal compiler error: Segmentation fault
 #pragma omp parallel shared(x)
 ^~~
0xebc6ef crash_signal
../../gcc/gcc/toplev.c:325
0xc61cac omp_add_variable
../../gcc/gcc/gimplify.c:6820
0xc763de gimplify_scan_omp_clauses
../../gcc/gcc/gimplify.c:8355
0xc66155 gimplify_omp_parallel
../../gcc/gcc/gimplify.c:9520
0xc66155 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11907
0xc698a6 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc6a5cc gimplify_bind_expr
../../gcc/gcc/gimplify.c:1331
0xc676ba gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11635
0xc698a6 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc6b29a gimplify_body(tree_node*, bool)
../../gcc/gcc/gimplify.c:12635
0xc6b794 gimplify_function_tree(tree_node*)
../../gcc/gcc/gimplify.c:12800
0xaf02b7 cgraph_node::analyze()
../../gcc/gcc/cgraphunit.c:670
0xaf2c53 analyze_functions
../../gcc/gcc/cgraphunit.c:1131
0xaf3a52 symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2691
Please submit a full bug report, [etc.]

The regression was introduced between 2018-02-25 and 2018-03-02,
most likely by Jason's fix r258015 for PR84559.
Before the code was wrongly accepted.

[Bug c++/85133] New: [7/8 Regression] [concepts] ICE with invalid concept used in variadic template

2018-03-30 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85133

Bug ID: 85133
   Summary: [7/8 Regression] [concepts] ICE with invalid concept
used in variadic template
   Product: gcc
   Version: 8.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
Blocks: 67491
  Target Milestone: ---

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

===
template concept bool C;

template struct A {};

A a;
===

bug.cc:1:33: error: variable concept has no initializer
 template concept bool C;
 ^
bug.cc:5:6: internal compiler error: in iterative_hash_template_arg, at
cp/pt.c:1713
 A a;
  ^
0x64ed6f iterative_hash_template_arg(tree_node*, unsigned int)
../../gcc-7.1.0/gcc/cp/pt.c:1713
0x64e280 iterative_hash_template_arg(tree_node*, unsigned int)
../../gcc-7.1.0/gcc/cp/pt.c:1732
0x65826d concept_spec_hasher::hash(concept_spec_entry*)
../../gcc-7.1.0/gcc/cp/pt.c:25880
0x65826d hash_table<concept_spec_hasher,
xcallocator>::find_slot(concept_spec_entry* const&, insert_option)
../../gcc-7.1.0/gcc/hash-table.h:414
0x65826d memoize_concept_satisfaction(tree_node*, tree_node*, tree_node*)
../../gcc-7.1.0/gcc/cp/pt.c:25941
0x85af29 satisfy_check_constraint
../../gcc-7.1.0/gcc/cp/constraint.cc:2058
0x85af29 satisfy_constraint_1
../../gcc-7.1.0/gcc/cp/constraint.cc:2247
0x85b460 satisfy_constraint
../../gcc-7.1.0/gcc/cp/constraint.cc:2302
0x85b866 constraints_satisfied_p(tree_node*, tree_node*)
../../gcc-7.1.0/gcc/cp/constraint.cc:2414
0x66579c gen_elem_of_pack_expansion_instantiation
../../gcc-7.1.0/gcc/cp/pt.c:11048
0x66579c tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc-7.1.0/gcc/cp/pt.c:11504
0x85a6d8 satisfy_pack_expansion
../../gcc-7.1.0/gcc/cp/constraint.cc:1983
0x85a6d8 satisfy_constraint_1
../../gcc-7.1.0/gcc/cp/constraint.cc:2274
0x85b460 satisfy_constraint
../../gcc-7.1.0/gcc/cp/constraint.cc:2302
0x85b553 satisfy_associated_constraints
../../gcc-7.1.0/gcc/cp/constraint.cc:2326
0x85b896 constraints_satisfied_p(tree_node*, tree_node*)
../../gcc-7.1.0/gcc/cp/constraint.cc:2416
0x699158 lookup_template_class_1
../../gcc-7.1.0/gcc/cp/pt.c:8707
0x699158 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-7.1.0/gcc/cp/pt.c:9009
0x7af3dd finish_template_type(tree_node*, tree_node*, int)
../../gcc-7.1.0/gcc/cp/semantics.c:3151
0x736c44 cp_parser_template_id
../../gcc-7.1.0/gcc/cp/parser.c:15495
Please submit a full bug report, [etc.]


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

[Bug c++/85113] New: [7/8 Regression] ICE with __builtin_constant_p

2018-03-28 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85113

Bug ID: 85113
   Summary: [7/8 Regression] ICE with __builtin_constant_p
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Keywords: ice-on-valid-code, rejects-valid
  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 on trunk:

===
template struct A {};

constexpr int foo()
{
  A<__builtin_constant_p(0)> a{};
  return 0;
}
===

bug.cc: In function 'constexpr int foo()':
bug.cc:5:28: internal compiler error: in coerce_template_parms, at cp/pt.c:8502
   A<__builtin_constant_p(0)> a{};
^
0x64a25b coerce_template_parms
../../gcc/gcc/cp/pt.c:8502
0x97b406 lookup_template_class_1
../../gcc/gcc/cp/pt.c:9016
0x97b406 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:9365
0x9abdfd finish_template_type(tree_node*, tree_node*, int)
../../gcc/gcc/cp/semantics.c:3227
0x928364 cp_parser_template_id
../../gcc/gcc/cp/parser.c:15852
0x92846e cp_parser_class_name
../../gcc/gcc/cp/parser.c:22383
0x93521f cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:6580
0x93521f cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6266
0x936c35 cp_parser_simple_type_specifier
../../gcc/gcc/cp/parser.c:17179
0x930ce5 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:16852
0x93e096 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13627
0x943790 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12937
0x944738 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x945169 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:12478
0x9236d3 cp_parser_statement
../../gcc/gcc/cp/parser.c:10927
0x924640 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11276
0x924717 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11230
0x93b230 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21789
0x93b230 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21826
0x93bae0 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26847
Please submit a full bug report, [etc.]

The regression was introduced between 2018-03-17 and 2018-03-20.

In addition the code is rejected on the GCC 7 branch (7.3.1)
while it was still accepted in GCC 7.3.0.

[Bug c++/85112] New: [8 Regression] ICE with invalid constexpr

2018-03-28 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85112

Bug ID: 85112
   Summary: [8 Regression] ICE with invalid constexpr
   Product: gcc
   Version: unknown
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 on trunk:

===
struct A
{
  int m;
  int n : 4;
};

int i;

void foo()
{
  constexpr int j = i;
  A a;
  a.n = j;
}
===

bug.cc: In function 'void foo()':
bug.cc:11:21: error: the value of 'i' is not usable in a constant expression
   constexpr int j = i;
 ^
bug.cc:7:5: note: 'int i' is not const
 int i;
 ^
bug.cc:13:7: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.c:86
   a.n = j;
   ^~~
0x78cafe tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc/gcc/tree.c:9372
0x6ce53d tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc/gcc/tree.h:3258
0x6ce53d useless_type_conversion_p(tree_node*, tree_node*)
../../gcc/gcc/gimple-expr.c:86
0x10bc78a tree_ssa_strip_useless_type_conversions(tree_node*)
../../gcc/gcc/tree-ssa.c:1253
0xc645a7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11330
0xc74513 gimplify_modify_expr
../../gcc/gcc/gimplify.c:5625
0xc65c10 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11434
0xc68d16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc66bb2 gimplify_cleanup_point_expr
../../gcc/gcc/gimplify.c:6399
0xc66bb2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11811
0xc68d16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc664bb gimplify_statement_list
../../gcc/gcc/gimplify.c:1764
0xc664bb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11863
0xc68d16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc69a3c gimplify_bind_expr
../../gcc/gcc/gimplify.c:1331
0xc66b2a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11635
0xc68d16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6658
0xc6a70a gimplify_body(tree_node*, bool)
../../gcc/gcc/gimplify.c:12635
0xc6ac04 gimplify_function_tree(tree_node*)
../../gcc/gcc/gimplify.c:12800
0xaef847 cgraph_node::analyze()
../../gcc/gcc/cgraphunit.c:670
Please submit a full bug report, [etc.]

The regression was introduced between 2017-06-06 and 2017-06-10.

[Bug c++/85061] ICE with __builtin_offsetof applied to static member

2018-03-28 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85061

Volker Reichelt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Volker Reichelt  ---
Fixed by Jakub's patch.

[Bug sanitizer/85081] New: [7(8 Regression] Sanitizer error with references in vectorized/parallel for-loop

2018-03-26 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85081

Bug ID: 85081
   Summary: [7(8 Regression] Sanitizer error with references in
vectorized/parallel for-loop
   Product: gcc
   Version: 8.0.1
Status: UNCONFIRMED
  Keywords: openmp, wrong-code
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet compiled with
"-fopenmp-simd -fsanitize=address"
is aborted by the sanitizer at runtime since GCC 7.1.0:


inline const int& max(const int& a, const int& b)
{
  return a < b ? b : a;
}

int main()
{
  #pragma omp simd
//   #pragma omp parallel for
  for ( int i = 0; i < 20; ++i )
  {
const int j = max(i, 1);
  }

  return 0;
}


==25412==ERROR: AddressSanitizer: stack-use-after-scope on address
0x7ffe6a4ecac0 at pc 0x0040090a bp 0x7ffe6a4eca80 sp 0x7ffe6a4eca78
WRITE of size 4 at 0x7ffe6a4ecac0 thread T0
#0 0x400909 in main (a.out+0x400909)
#1 0x7f88f7f84724 in __libc_start_main (/lib64/libc.so.6+0x20724)
#2 0x400748 in _start (a.out+0x400748)

Address 0x7ffe6a4ecac0 is located in stack of thread T0 at offset 32 in frame
#0 0x400805 in main (a.out+0x400805)

  This frame has 2 object(s):
[32, 36) '' <== Memory access at offset 32 is inside this variable
[96, 100) 'i'
HINT: this may be a false positive if your program uses some custom stack
unwind mechanism or swapcontext
  (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-scope (a.out+0x400909) in main
Shadow bytes around the buggy address:
  0x10004d495900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x10004d495950: 00 00 00 00 f1 f1 f1 f1[f8]f2 f2 f2 f2 f2 f2 f2
  0x10004d495960: 04 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00
  0x10004d495970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d495990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004d4959a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:   00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:   fa
  Freed heap region:   fd
  Stack left redzone:  f1
  Stack mid redzone:   f2
  Stack right redzone: f3
  Stack after return:  f5
  Stack use after scope:   f8
  Global redzone:  f9
  Global init order:   f6
  Poisoned by user:f7
  Container overflow:  fc
  Array cookie:ac
  Intra object redzone:bb
  ASan internal:   fe
  Left alloca redzone: ca
  Right alloca redzone:cb
==25412==ABORTING

The address-sanitizer also complains with "#pragma omp parallel for"
and "-fopenmp".
The problem persists if I change the return value of "max" to "int",
but disappears if I change the arguments to plain "int".

I don't know whether this is a sanitizer or OpenMP (or even a C++ frontend)
issue.

  1   2   3   4   5   6   7   8   >