From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D3BB33858D32; Mon, 23 Jan 2023 17:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3BB33858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674496162; bh=lShMJM3WUgHQxTHhBjibeWA4P8muLoK/a2fOCmdw/0M=; h=From:To:Subject:Date:From; b=LNPEG2/01UIhXcvrUN2RzjNT1zmHoMBowTeYx+KJGzuQbHzwHgTN+VCbXuVEByVwP fZAEhdhA1dmnd9Wm4iowMLH1EJKkHlpGoDtfxLuQRJPMkZqP71Mkl7vZpvt31aWtca 8D36bSrPZ49oL1lSF1Q+rsIw3eZkhvfdfl+CdcfA= From: "gscfq@t-online.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108503] New: [13 Regression] ICE in get_array_or_vector_nelts, at cp/constexpr.cc:4119 Date: Mon, 23 Jan 2023 17:49:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gscfq@t-online.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108503 Bug ID: 108503 Summary: [13 Regression] ICE in get_array_or_vector_nelts, at cp/constexpr.cc:4119 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gscfq@t-online.de Target Milestone: --- Started between 20221127 and 20221204 : $ cat z1.cc namespace std { template struct tuple_size; template struct tuple_element; } struct A { template int& get() { return 1; } }; template<> struct std::tuple_size { static const int value =3D 3; }; template struct std::tuple_element { using type =3D int; }; struct B { A *begin(); A *end(); }; void f (B a) { #pragma omp for collapse(2) for (auto [i, j, k] : a) for (int l =3D i; l < j; l +=3D k) ; } $ g++-13-20230122 -c z1.cc -fopenmp -Wall z1.cc: In member function 'int& A::get()': z1.cc:6:40: error: cannot bind non-const lvalue reference of type 'int&' to= an rvalue of type 'int' 6 | template int& get() { return 1; } | ^ z1.cc: In function 'void f(B)': z1.cc:18:25: internal compiler error: in get_array_or_vector_nelts, at cp/constexpr.cc:4119 18 | for (int l =3D i; l < j; l +=3D k) | ^ 0x88770e get_array_or_vector_nelts ../../gcc/cp/constexpr.cc:4119 0x887804 eval_and_check_array_index ../../gcc/cp/constexpr.cc:4171 0x88b5e9 cxx_eval_array_reference ../../gcc/cp/constexpr.cc:4208 0x8826ed cxx_eval_constant_expression ../../gcc/cp/constexpr.cc:7516 0x880e9a cxx_eval_constant_expression ../../gcc/cp/constexpr.cc:7042 0x8837ac cxx_eval_indirect_ref ../../gcc/cp/constexpr.cc:5642 0x8837ac cxx_eval_constant_expression ../../gcc/cp/constexpr.cc:7358 0x88d3ba cxx_eval_outermost_constant_expr ../../gcc/cp/constexpr.cc:8252 0x892882 maybe_constant_value(tree_node*, tree_node*, bool) ../../gcc/cp/constexpr.cc:8527 0x956053 fold_for_warn(tree_node*) ../../gcc/cp/expr.cc:421 0xc1d801 warn_tautological_cmp(op_location_t const&, tree_code, tree_node*, tree_node*) ../../gcc/c-family/c-warn.cc:485 0x84369b build_new_op(op_location_t const&, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../gcc/cp/call.cc:7354 0xb485cd build_x_binary_op(op_location_t const&, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node*, tree_node**, int) ../../gcc/cp/typeck.cc:4722 0xa1c40f cp_parser_omp_for_cond ../../gcc/cp/parser.cc:42701 0xa1c40f cp_parser_omp_for_loop ../../gcc/cp/parser.cc:43652 0xa410f6 cp_parser_omp_for ../../gcc/cp/parser.cc:44005 0xa56f14 cp_parser_omp_construct ../../gcc/cp/parser.cc:48527 0xa20a7f cp_parser_pragma ../../gcc/cp/parser.cc:49207 0xa2740c cp_parser_statement ../../gcc/cp/parser.cc:12434 0xa28884 cp_parser_statement_seq_opt ../../gcc/cp/parser.cc:12909=