[Bug c++/94751] New: [9/10] ICE on invalid code in maybe_instantiate_noexcept
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94751 Bug ID: 94751 Summary: [9/10] ICE on invalid code in maybe_instantiate_noexcept Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc version: gcc version 10.0.1 20200329 (experimental) (GCC) ICEs on the following (invalid) input: -- x.cc - struct Algorithm { Algorithm( float ); }; template struct ToolWithConstants : public Algorithm { using Algorithm::Algorithm; struct Constant { Constant (int name); }; Constant c { "order" }; }; class unique_ptr {}; unique_ptr make() { return unique_ptr (new ToolWithConstants (10.5)); } like this: [sss@karma rootaccess]$ g++ -c x.cc x.cc: In function ‘unique_ptr make()’: x.cc:25:60: internal compiler error: Segmentation fault 25 | return unique_ptr (new ToolWithConstants (10.5)); |^ 0xc4fe4f crash_signal /home/sss/gcc/gcc/gcc/toplev.c:328 0x7f4d24bf8ebf ??? /usr/src/debug/glibc-2.29-51-g845278f2c6/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x759eff maybe_instantiate_noexcept(tree_node*, int) /home/sss/gcc/gcc/gcc/cp/pt.c:25032 0x6b8388 mark_used(tree_node*, int) /home/sss/gcc/gcc/gcc/cp/decl2.c:5512 0x644892 build_over_call /home/sss/gcc/gcc/gcc/cp/call.c:9048 0x646ade build_new_method_call_1 /home/sss/gcc/gcc/gcc/cp/call.c:10338 0x647796 build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int) /home/sss/gcc/gcc/gcc/cp/call.c:10413 0x647796 build_special_member_call(tree_node*, tree_node*, vec**, tree_node*, int, int) /home/sss/gcc/gcc/gcc/cp/call.c:9814 0x6cec5f build_new_1 /home/sss/gcc/gcc/gcc/cp/init.c:3588 0x6cf9f8 build_new(unsigned int, vec**, tree_node*, tree_node*, vec**, int, int) /home/sss/gcc/gcc/gcc/cp/init.c:3905 0x729a37 cp_parser_new_expression /home/sss/gcc/gcc/gcc/cp/parser.c:8825 0x72a057 cp_parser_unary_expression /home/sss/gcc/gcc/gcc/cp/parser.c:8418 0x706b1a cp_parser_binary_expression /home/sss/gcc/gcc/gcc/cp/parser.c:9554 0x7081ce cp_parser_assignment_expression /home/sss/gcc/gcc/gcc/cp/parser.c:9859 0x70a668 cp_parser_parenthesized_expression_list /home/sss/gcc/gcc/gcc/cp/parser.c:7981 0x70ada2 cp_parser_functional_cast /home/sss/gcc/gcc/gcc/cp/parser.c:29572 0x721f24 cp_parser_postfix_expression /home/sss/gcc/gcc/gcc/cp/parser.c:7180 0x706b1a cp_parser_binary_expression /home/sss/gcc/gcc/gcc/cp/parser.c:9554 0x7081ce cp_parser_assignment_expression /home/sss/gcc/gcc/gcc/cp/parser.c:9859 0x7084e2 cp_parser_expression /home/sss/gcc/gcc/gcc/cp/parser.c:10027 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. A crash is also observed with a 20200424 version as well as gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC) thanks, sss
[Bug c++/93137] New: [10 regression] ICE in refs_may_alias_p_2
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93137 Bug ID: 93137 Summary: [10 regression] ICE in refs_may_alias_p_2 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - With this version of gcc10 (svn rev 279832): gcc version 10.0.0 20200102 (experimental) (GCC) this source gives an ICE when compiled with -O: -- x.cc - #include void foo (const std::string& s) { struct GCCLibSuffix { std::string LibSuffix; bool Active; } Suffixes[] = { {"/gcc/" + s, true} }; } - $ g++ -std=c++17 -O -c x.cc during IPA pass: fnsummary x.cc: In function ‘void foo(const string&)’: x.cc:13:1: internal compiler error: Segmentation fault 13 | } | ^ 0xc1467f crash_signal /home/sss/gcc/gcc/gcc/toplev.c:328 0xcdb7c4 refs_may_alias_p_2 /home/sss/gcc/gcc/gcc/tree-ssa-alias.c:2190 0xcdc736 refs_may_alias_p_1(ao_ref*, ao_ref*, bool) /home/sss/gcc/gcc/gcc/tree-ssa-alias.c:2227 0xcdc736 stmt_may_clobber_ref_p_1(gimple*, ao_ref*, bool) /home/sss/gcc/gcc/gcc/tree-ssa-alias.c:3001 0xcdcdc0 walk_aliased_vdefs_1 /home/sss/gcc/gcc/gcc/tree-ssa-alias.c:3656 0xcdcf0f walk_aliased_vdefs(ao_ref*, tree_node*, bool (*)(ao_ref*, tree_node*, void*), void*, bitmap_head**, bool*, unsigned int) /home/sss/gcc/gcc/gcc/tree-ssa-alias.c:3679 0xa4cda2 parm_ref_data_pass_through_p /home/sss/gcc/gcc/gcc/ipa-prop.c:1052 0xa58c39 ipa_compute_jump_functions_for_edge /home/sss/gcc/gcc/gcc/ipa-prop.c:2237 0xa59cca ipa_compute_jump_functions_for_bb /home/sss/gcc/gcc/gcc/ipa-prop.c:2297 0xa59cca analysis_dom_walker::before_dom_children(basic_block_def*) /home/sss/gcc/gcc/gcc/ipa-prop.c:2823 0x137e977 dom_walker::walk(basic_block_def*) /home/sss/gcc/gcc/gcc/domwalk.c:309 0xa5495d ipa_analyze_node(cgraph_node*) /home/sss/gcc/gcc/gcc/ipa-prop.c:2893 0xa3c4df inline_indirect_intraprocedural_analysis /home/sss/gcc/gcc/gcc/ipa-fnsummary.c:4020 0xa3c4df inline_analyze_function(cgraph_node*) /home/sss/gcc/gcc/gcc/ipa-fnsummary.c:4040 0xa3c653 ipa_fn_summary_generate /home/sss/gcc/gcc/gcc/ipa-fnsummary.c:4084 0xb5848b execute_ipa_summary_passes(ipa_opt_pass_d*) /home/sss/gcc/gcc/gcc/passes.c:2189 0x86564d ipa_passes /home/sss/gcc/gcc/gcc/cgraphunit.c:2629 0x86564d symbol_table::compile() /home/sss/gcc/gcc/gcc/cgraphunit.c:2739 0x86712c symbol_table::compile() /home/sss/gcc/gcc/gcc/cgraphunit.c:2719 0x86712c symbol_table::finalize_compilation_unit() /home/sss/gcc/gcc/gcc/cgraphunit.c:2986 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ Compiles OK with gcc 9.2.1. The source from which this was reduced also built ok with gcc trunk 10.0.0 20191202.
[Bug c++/93138] New: [10 regression] elaborated type specifier visibility check problem
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93138 Bug ID: 93138 Summary: [10 regression] elaborated type specifier visibility check problem Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - With this version of gcc10 (svn rev 279832): gcc version 10.0.0 20200102 (experimental) (GCC) This source does not compile: -- x.cc - struct Foo { enum Kind { a }; private: Kind Kind; }; enum Foo::Kind foo(); - $ g++ -std=c++17 -c x.cc x.cc: In function ‘Foo::Kind foo()’: x.cc:9:11: error: ‘Foo::Kind Foo::Kind’ is private within this context 9 | enum Foo::Kind foo(); | ^~~~ x.cc:6:8: note: declared private here 6 | Kind Kind; |^~~~ $ This does compile OK with gcc 9.2.1 and with clang 8.0.0 The source from which this was reduced also built ok with gcc trunk 10.0.0 20191202.
[Bug c++/88485] New: [9 regression] parse error on explicitly specialized assignment call
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88485 Bug ID: 88485 Summary: [9 regression] parse error on explicitly specialized assignment call Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc9 rejects the following code: - template class Base {}; class Block : public Base {}; template class Foo { template Block& operator=(const Base& other); Block& operator=(const Block& other) { return operator=(other); } }; - $ cc1plus -quiet -version x.cc GNU C++14 (GCC) version 9.0.0 20181212 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 9.0.0 20181212 (experimental), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++14 (GCC) version 9.0.0 20181212 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 9.0.0 20181212 (experimental), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: c0eebf4a7781166f39f275d6d099325f x.cc: In member function ‘Block& Foo::operator=(const Block&)’: x.cc:12:27: error: expected primary-expression before ‘>’ token 12 | return operator=(other); | ^ - The same code is accepted by both gcc 8.2.1 and clang 6.0.1. The error also goes away if the class `Foo' is changed to be a non-template class, or if `operator=' is changed to a named method.
[Bug c++/83690] New: [8 regression] spurious unused variable warings for variables used only in static_assert
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83690 Bug ID: 83690 Summary: [8 regression] spurious unused variable warings for variables used only in static_assert Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- As of gcc version 8.0.0 20180102 (experimental) (GCC) gcc gives an unused-but-set warning for variables that are used only in a static_assert. For example, with this source: --- x.cc - void foo() { constexpr bool foo = true; static_assert(foo, "foo"); } -- we get a warning: $ cc1plus -std=c++17 x.cc -quiet -Wall x.cc: In function ‘void foo()’: x.cc:3:18: warning: variable ‘foo’ set but not used [-Wunused-but-set-variable] constexpr bool foo = true; ^~~ We do not get this warning with gcc 7.2.1.
[Bug c++/83919] New: [8 regression] spurious -Wignored-qualifiers warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83919 Bug ID: 83919 Summary: [8 regression] spurious -Wignored-qualifiers warning Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- With gcc version gcc version 8.0.1 20180115 (experimental) (GCC) compiling this source with -Wextra -std=c++17 gets a warning: -- x.cc - enum class Conf; struct foo { foo (const Conf& conf) : x{conf} {} const Conf x; }; -- $ ~/gcc/build/gcc/cc1plus -quiet x.cc -Wextra -std=c++17 x.cc: In constructor ‘foo::foo(const Conf&)’: x.cc:4:34: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers] foo (const Conf& conf) : x{conf} {} ^ I don't see any obvious reason why this should give a warning. The warning goes away if one uses x(conf) rather than x{conf} in the initialization. I also do not see this warning with gcc 7.2.1.
[Bug middle-end/61037] array-bounds false positive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61037 scott snyder changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #1 from scott snyder --- I don't reproduce this any more with either gcc 7 or 8.
[Bug c++/86374] New: [8 regression] template member name lookup problem
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86374 Bug ID: 86374 Summary: [8 regression] template member name lookup problem Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - With gcc checked out on 2018-07-01 from gcc-8-branch (rev 262277, tested on x86_64-pc-linux-gnu [fedora 28]), this input: -- y.cc template struct list { static const int index = 1; template struct addWithChecking {}; }; template struct find{ static const int result = 0; }; template template struct list::addWithChecking { static const int xres = find >::result; }; gives an error: $ cc1plus -quiet -v -D_GNU_SOURCE y.cc -quiet -std=c++17 ... y.cc:16:43: error: ‘index’ is not a member of ‘list’ static const int xres = find >::result; ^ y.cc:16:43: error: template argument 2 is invalid This was accepted by gcc on this branch as of early June, as well as 8.1.1 20180502 and clang 6.0.0. The error started occurring with this change: r261460 | jason | 2018-06-11 18:01:55 -0400 (Mon, 11 Jun 2018) | 5 lines PR c++/85815 - reference to member of enclosing template. * search.c (lookup_base): Use currently_open_class. (lookup_member): Use it regardless of -fconcepts. * parser.c (cp_parser_postfix_dot_deref_expression): Check it. thanks, sss
[Bug c++/88385] New: [9 regression] ICE in tsubst_pack_expansion
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88385 Bug ID: 88385 Summary: [9 regression] ICE in tsubst_pack_expansion Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc 20181205 gets an ICE compiling this code. (8.2.1 compiles it without error.) thanks, sss -- template struct xtest { static const bool value = true; }; template struct compressed_tuple_ { template constexpr compressed_tuple_(Args &&... args) noexcept(xtest... >::value) ; }; struct adaptor_cursor_t : public compressed_tuple_ { using compressed_tuple_::compressed_tuple_; }; struct tadap { static constexpr adaptor_cursor_t begin_cursor_() noexcept(noexcept(adaptor_cursor_t{ 41, 42 })); }; -- $ ~/gcc/build/gcc/cc1plus -quiet -D_GNU_SOURCE x.cc -std=c++17 -version -o x.s GNU C++17 (GCC) version 9.0.0 20181205 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 9.0.0 20181205 (experimental), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++17 (GCC) version 9.0.0 20181205 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 9.0.0 20181205 (experimental), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.0.2, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: f55eeb31a29ad4100f3c306670176e86 x.cc: In instantiation of ‘constexpr adaptor_cursor_t::adaptor_cursor_t(Args&& ...) [with Args = {int, int}][inherited from compressed_tuple_]’: x.cc:17:8: required from ‘constexpr adaptor_cursor_t::adaptor_cursor_t(Args&& ...) [with Args = {int, int}][inherited from compressed_tuple_]’ x.cc:26:50: required from here x.cc:17:8: internal compiler error: in tsubst_pack_expansion, at cp/pt.c:12213 17 | struct adaptor_cursor_t : public compressed_tuple_ |^~~~ 0x6ed024 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) /home/sss/gcc/gcc/gcc/cp/pt.c:12213 0x6ed905 tsubst_template_args /home/sss/gcc/gcc/gcc/cp/pt.c:12446 0x6ee1c1 tsubst_aggr_type /home/sss/gcc/gcc/gcc/cp/pt.c:12672 0x6f2c0d tsubst(tree_node*, tree_node*, int, tree_node*) /home/sss/gcc/gcc/gcc/cp/pt.c:14324 0x6f4e31 tsubst_qualified_id /home/sss/gcc/gcc/gcc/cp/pt.c:15215 0x6fec27 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/sss/gcc/gcc/gcc/cp/pt.c:18357 0x70c954 maybe_instantiate_noexcept(tree_node*, int) /home/sss/gcc/gcc/gcc/cp/pt.c:24007 0x64051c start_preparsed_function(tree_node*, tree_node*, int) /home/sss/gcc/gcc/gcc/cp/decl.c:15454 0x686818 synthesize_method(tree_node*) /home/sss/gcc/gcc/gcc/cp/method.c:914 0x70da8c instantiate_decl(tree_node*, bool, bool) /home/sss/gcc/gcc/gcc/cp/pt.c:24408 0x61735b instantiate_cx_fn_r /home/sss/gcc/gcc/gcc/cp/constexpr.c:4953 0xde35c8 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*)) /home/sss/gcc/gcc/gcc/tree.c:11924 0xde38dc walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*)) /home/sss/gcc/gcc/gcc/tree.c:12246 0xde3250 walk_tree_without_duplicates_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*)) /home/sss/gcc/gcc/gcc/tree.c:12272 0x61ea2e instantiate_constexpr_fns /home/sss/gcc/gcc/gcc/cp/constexpr.c:4972 0x61ea2e is_sub_constant_expr(tree_node*) /home/sss/gcc/gcc/gcc/cp/constexpr.c:5140 0x668a27 check_noexcept_r /home/sss/gcc/gcc/gcc/cp/except.c:1041 0xde35c8 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*)) /home/sss/gcc/gcc/gcc/tree.c:11924 0xde3a46 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*)) /home/sss/gcc/gcc/gcc/tree.c:12156 0xde3250 walk_tree_without_duplicates_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_no
[Bug c++/79077] New: [7 regression][new inheriting ctors] bad code for inherited ctor
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79077 Bug ID: 79077 Summary: [7 regression][new inheriting ctors] bad code for inherited ctor Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- Target: x86_64-pc-linux-gnu hi - This bug may be related to 78495. gcc version 7.0.0 20170111 generates bad code for this example (tested on x86_64-pc-linux-gnu): extern "C" { int printf(const char* fmt, ...); } class xstring { public: xstring(const char* s) : m_str(s) {} xstring(const xstring& s) : m_str(s.m_str) {} const char* c_str() const { return m_str; } const char* m_str; }; class Service { public: Service( xstring name) { printf (" bbb %s\n", name.c_str()); } }; class extends: public Service { public: using Service::Service; }; class AlgExecStateSvc : public extends { public: AlgExecStateSvc( const xstring& name) : extends(name) { printf (" aaa %s\n", name.c_str()); } }; int main() { AlgExecStateSvc ss ("asd"); return 0; } I expect this to print: bbb asd aaa asd and this is what it does print with gcc6 or when compiled with -fno-new-inheriting-ctors. But with new-inheriting-ctors on, then the example prints garbage after the `bbb ' in the first line; the second line is still printed correctly. Things seem to go wrong in the code generated for the ctor in extends wrapping the base class. The base Service ctor expects that %rsi contain a pointer to the xstring structure, and the extends ctor is called wiht %rsi being a pointer to the xstring. However, the derived ctor actually calls the base ctor with a pointer to a pointer to the xstring. _ZN7extendsCI27ServiceE7xstring: .LFB12: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq%rsp, %rbp .cfi_def_cfa_register 6 subq$32, %rsp movq%rdi, -24(%rbp) movq%rsi, -32(%rbp) movq-32(%rbp), %rax movq%rax, -8(%rbp) leaq-8(%rbp), %rdx movq-24(%rbp), %rax movq%rdx, %rsi movq%rax, %rdi call_ZN7ServiceC2E7xstring nop leave One can also see what appears to be an extra `&' in the 003t.original dump: ;; Function extends::extends(xstring) [inherited from Service] (null) ;; enabled by -tree-original { <>>>>; }
[Bug c++/79091] New: [7 regression] ICE in write_unnamed_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79091 Bug ID: 79091 Summary: [7 regression] ICE in write_unnamed_type Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc version 7.0.0 20170111 gives an ICE for this example (tested on x86_64-pc-linux-gnu): enum { ColMajor = 0 }; template class Matrix {}; class RotationBase { public: Matrix<3> toRotationMatrix() const; }; template Matrix toRotationMatrix(const RotationBase& r) { return r.toRotationMatrix(); } class Transform { public: Transform(const RotationBase& r) { toRotationMatrix<3>(r); } }; void localStripPos() { RotationBase t2; Transform transfPtr_internalgeo(t2); } $ cc1plus -v x.cc Matrix toRotationMatrix(const RotationBase&) Transform::Transform(const RotationBase&) Matrix<3> Transform::Transform(const RotationBase&) Transform::Transform(const RotationBase&) void localStripPos() Matrix toRotationMatrix(const RotationBase&) [with int Dim = 3] Analyzing compilation unit x.cc: In instantiation of ‘Matrix toRotationMatrix(const RotationBase&) [with int Dim = 3]’: x.cc:17:13: internal compiler error: in write_unnamed_type_name, at cp/mangle.c:1623 Matrix toRotationMatrix(const RotationBase& r) ^~~~ 0xa4755c write_unnamed_type_name /home/sss/gcc/gcc/gcc/cp/mangle.c:1623 0xa4642a write_unqualified_name /home/sss/gcc/gcc/gcc/cp/mangle.c:1382 0xa43af6 write_unscoped_name /home/sss/gcc/gcc/gcc/cp/mangle.c:1007 0xa43857 write_name /home/sss/gcc/gcc/gcc/cp/mangle.c:939 0xa4dd94 write_class_enum_type /home/sss/gcc/gcc/gcc/cp/mangle.c:2769 0xa4a825 write_type /home/sss/gcc/gcc/gcc/cp/mangle.c:2187 0xa51b76 write_template_arg_literal /home/sss/gcc/gcc/gcc/cp/mangle.c:3341 0xa4e4d6 write_expression /home/sss/gcc/gcc/gcc/cp/mangle.c:2883 0xa51ac4 write_expression /home/sss/gcc/gcc/gcc/cp/mangle.c:3324 0xa529ae write_template_arg /home/sss/gcc/gcc/gcc/cp/mangle.c:3485 0xa4df09 write_template_args /home/sss/gcc/gcc/gcc/cp/mangle.c:2798 0xa43846 write_name /home/sss/gcc/gcc/gcc/cp/mangle.c:935 0xa4dd94 write_class_enum_type /home/sss/gcc/gcc/gcc/cp/mangle.c:2769 0xa4a825 write_type /home/sss/gcc/gcc/gcc/cp/mangle.c:2187 0xa4da08 write_bare_function_type /home/sss/gcc/gcc/gcc/cp/mangle.c:2692 0xa431a5 write_encoding /home/sss/gcc/gcc/gcc/cp/mangle.c:848 0xa42b96 write_mangled_name /home/sss/gcc/gcc/gcc/cp/mangle.c:788 0xa539a1 mangle_decl_string /home/sss/gcc/gcc/gcc/cp/mangle.c:3743 0xa539e7 get_mangled_id /home/sss/gcc/gcc/gcc/cp/mangle.c:3765 0xa53eab mangle_decl(tree_node*) /home/sss/gcc/gcc/gcc/cp/mangle.c:3835 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. The assertion that trips is in mangle.c:write_unnamed_type_name, here: write_unnamed_type_name (const tree type) { int discriminator; MANGLE_TRACE_TREE ("unnamed-type-name", type); if (TYPE_FUNCTION_SCOPE_P (type)) discriminator = local_class_index (type); else if (TYPE_CLASS_SCOPE_P (type)) discriminator = nested_anon_class_index (type); else { gcc_assert (no_linkage_check (type, /*relaxed_p=*/true)); /* Just use the old mangling at namespace scope. */ write_source_name (TYPE_IDENTIFIER (type)); return; } where TYPE is unit size align 32 symtab 0 alias set -1 canonical type 0x70033dc8 precision 1 min max > unsigned type_6 SI size unit size align 32 symtab 0 alias set -1 canonical type 0x70033d20 precision 32 min max values local bindings <(nil)>> value readonly constant used VOID file x.cc line 2 col 3 align 1 context initial chain >> context chain >
[Bug c++/79095] New: [7 regression] spurious stringop-overflow warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79095 Bug ID: 79095 Summary: [7 regression] spurious stringop-overflow warning Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc version 7.0.0 20170111 gives what appears to be a spurious warning for this example when compiling with -O3 (tested on x86_64-pc-linux-gnu): #include void foo(std::vector &v); void vtest() { std::vector v; foo (v); //if (v.size() > 0) { v.resize (v.size()-1); } } $ gcc -c -O3 x.cc In function ‘void vtest()’: cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] The size reported is -4 as an unsigned, so the warning must be coming from considering the possibility that v.size() is 0. But we really shouldn't be warning unless it can be shown that foo() can leave the vector empty, and in any case adding the explicit test on the vector size (shown commented out) does not get rid of the warning.
[Bug c++/79159] New: [7 regression] spurious array-bounds warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79159 Bug ID: 79159 Summary: [7 regression] spurious array-bounds warning Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- hi - gcc version 7.0.0 20170119 gives what appears to be a spurious warning for this example when compiling with -O3 (tested on x86_64-pc-linux-gnu): void foo(float tmpCorr[9][9]); float bar; void finalDigits(int& n) { float tmpCorr[9][9] = {{0}}; foo(tmpCorr); for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { bar = tmpCorr[i][j]; } } } $ ~/gcc/build/gcc/cc1plus -quiet -O3 -Wall x.cc x.cc: In function ‘void finalDigits(int&)’: x.cc:11:25: warning: array subscript is above array bounds [-Warray-bounds] bar = tmpCorr[i][j]; ^ I do not see this warning with gcc 6.3.1. This doesn't make sense, since there is no basis for making any assumptions about the value of the iteration limit n. The warning goes away if i remove the call to foo(), if function parameter is changed to be passed by value rather than by reference, or if the lower limit of the j iteration is changed to i rather than i+1.
[Bug c++/79091] [7 regression] ICE in write_unnamed_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79091 --- Comment #7 from scott snyder --- Confirmed that this fixes the original problem from which the test case was derived. Thanks!
[Bug middle-end/61037] New: array-bounds false positive
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61037 Bug ID: 61037 Summary: array-bounds false positive Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org hi - I'm using gcc from the 4.9 branch: GNU C++ (GCC) version 4.9.1 20140502 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.9.1 20140502 (prerelease), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 When I compile this test case with -O3: struct S { char m_a[21]; int m_b[21]; void copy(const S& other); }; void S::copy(const S& other) { for(int i=0; i<21; ++i) { m_b[i] = other.m_b[i]; m_a[i] = other.m_a[i]; } } I get array bounds warnings: $ cc1plus -quiet x.cc -O3 -Wall -o x.s x.cc: In member function ‘void S::copy(const S&)’: x.cc:14:25: warning: array subscript is above array bounds [-Warray-bounds] m_a[i] = other.m_a[i]; ^ x.cc:14:10: warning: array subscript is above array bounds [-Warray-bounds] m_a[i] = other.m_a[i]; ^ ... For a total of ten copies of those two messages. The warnings go away if `21' is changed to `20' in the test; 21 is the smallest i've found that shows the problem. thanks, sss
[Bug middle-end/67821] New: [gcc 5 regression] ICE in duplicate_ssa_name_range_info
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67821 Bug ID: 67821 Summary: [gcc 5 regression] ICE in duplicate_ssa_name_range_info Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: s...@li-snyder.org Target Milestone: --- Created attachment 36438 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36438&action=edit test case hi - I'm testing gcc from the gcc-5-branch svn branch. Using the version as of 2 oct 2015 (svn rev 228385), i get an ICE compiling the attached if -O2 is used. (Reduced from core/clib/src/Demangle.c in root 6.02.08, which appears itself to have been copied from libiberty.) $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-unknown-linux-gnu/5.2.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/sss/gcc/gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,fortran Thread model: posix gcc version 5.2.1 20151002 (GCC) $ gcc -c -O2 x.c x.c: In function ‘demangle_qualified’: x.c:6:9: warning: implicit declaration of function ‘isdigit’ [-Wimplicit-function-declaration] if (!isdigit (*p)) ^ x.c:1:5: internal compiler error: in duplicate_ssa_name_range_info, at tree-ssanames.c:506 int demangle_qualified (const char* mangled) ^ 0xb29f14 duplicate_ssa_name_range_info(tree_node*, value_range_type, range_info_def*) /home/sss/gcc/gcc/gcc/tree-ssanames.c:506 0xacdff3 eliminate_dom_walker::before_dom_children(basic_block_def*) /home/sss/gcc/gcc/gcc/tree-ssa-pre.c:4151 0xe9d5e1 dom_walker::walk(basic_block_def*) /home/sss/gcc/gcc/gcc/domwalk.c:188 0xacc23b eliminate /home/sss/gcc/gcc/gcc/tree-ssa-pre.c:4540 0xad405e execute /home/sss/gcc/gcc/gcc/tree-ssa-pre.c:4894 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ tree-ssanames.c:506 is this line: gcc_assert (!SSA_NAME_ANTI_RANGE_P (name)); The last update i did from gcc-5-branch was about a month ago, and i did not see this crash with that version. thanks, sss