public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
@ 2022-02-14 10:24 asolokha at gmx dot com
  2022-02-14 11:55 ` [Bug c++/104527] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-02-14 10:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

            Bug ID: 104527
           Summary: [11/12 Regression] ICE: tree check: accessed elt 1 of
                    'tree_vec' with 0 elts in hash, at
                    cp/constraint.cc:2486
           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: asolokha at gmx dot com
                CC: ppalka at gcc dot gnu.org
  Target Milestone: ---

gcc 12.0.1 20220213 snapshot (g:58aeb75d4097010ad9bb72b964265b18ab284f93) ICEs
when compiling the following testcase, reduced from
test/SemaTemplate/instantiate-requires-expr.cpp from the clang 13.0.0 test
suite, w/ -std=c++20 (or -fconcepts):

template<typename T, typename U>
constexpr bool is_same_v = false;

namespace expr_requirement {
  template<typename T, typename U = int>
  concept C1 = is_same_v<T, U>;

  template<typename T>
  struct b {
      template<typename U>
        requires (requires { { 0 } -> C1<typename T::a>; }, false)
      struct r {};
  };

  using bri = b<int>::r<short>;
}

% g++-12.0.1 -fconcepts -c s6aywpah.cpp
s6aywpah.cpp: In substitution of 'template<class T> template<class U>  requires
(requires{{0} -> decltype(auto) [requires expr_requirement::C1<<placeholder>,
typename T::a>];}, false) struct expr_requirement::b<T>::r [with U = short int;
T = int]':
s6aywpah.cpp:15:30:   required from here
s6aywpah.cpp:11:32: internal compiler error: tree check: accessed elt 1 of
'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
   11 |         requires (requires { { 0 } -> C1<typename T::a>; }, false)
      |                              ~~^~~~~~~~~~~~~~~~~~~~~~~~
0x8768fa tree_vec_elt_check_failed(int, int, char const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/tree.cc:8889
0x9a55e3 tree_vec_elt_check(tree_node*, int, char const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/tree.h:3666
0x9a55e3 sat_hasher::hash(sat_entry*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2486
0x9a13a3 hash_table<sat_hasher, false, xcallocator>::find_slot(sat_entry*
const&, insert_option)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/hash-table.h:435
0x9a13a3 satisfaction_cache::satisfaction_cache(tree_node*, tree_node*,
sat_info)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2580
0x9a442e satisfy_atom
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2897
0x9a442e satisfy_constraint_r
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:3006
0x9a4d14 satisfy_normalized_constraints
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:3031
0x9a2bc8 satisfy_nondeclaration_constraints
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:3113
0x9a2bc8 constraint_satisfaction_value
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:3268
0x9a4dd4 constraints_satisfied_p(tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:3300
0xb20299 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/pt.cc:30234
0x9a3610 type_deducible_p
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2010
0x9a3610 tsubst_compound_requirement
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2075
0x9a3610 tsubst_requirement
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2155
0x9a3610 tsubst_requires_expr
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2278
0x9a4d7b tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/constraint.cc:2297
0xb27141 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/pt.cc:21288
0xb3e921 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/pt.cc:19413
0xb3fc67 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220213/work/gcc-12-20220213/gcc/cp/pt.cc:19391

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
@ 2022-02-14 11:55 ` rguenth at gcc dot gnu.org
  2022-02-14 16:16 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-14 11:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
  2022-02-14 11:55 ` [Bug c++/104527] " rguenth at gcc dot gnu.org
@ 2022-02-14 16:16 ` jakub at gcc dot gnu.org
  2022-02-14 16:23 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-14 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Priority|P3                          |P2
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-14

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
ICEs since r11-7454-ge52f8ec25c0e58ebd083e8370e2fbc8af4120d87

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
  2022-02-14 11:55 ` [Bug c++/104527] " rguenth at gcc dot gnu.org
  2022-02-14 16:16 ` jakub at gcc dot gnu.org
@ 2022-02-14 16:23 ` ppalka at gcc dot gnu.org
  2022-03-12 20:02 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-14 16:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-02-14 16:23 ` ppalka at gcc dot gnu.org
@ 2022-03-12 20:02 ` cvs-commit at gcc dot gnu.org
  2022-03-12 20:05 ` [Bug c++/104527] [11 " ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-12 20:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:9413bb55185b9e88d84e91d5145d59f9f83b884a

commit r12-7631-g9413bb55185b9e88d84e91d5145d59f9f83b884a
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Mar 12 15:00:40 2022 -0500

    c++: return-type-req in constraint using only outer tparms [PR104527]

    Here the template context for the atomic constraint has two levels of
    template parameters, but since it depends only on the innermost parameter
    T we use a single-level argument vector (built by get_mapped_args) during
    substitution into the atom.  We eventually pass this vector to
    do_auto_deduction as part of checking the return-type-requirement within
    the atom, but do_auto_deduction expects outer_targs to be a full set of
    arguments for sake of satisfaction.

    This patch fixes this by making get_mapped_args always return an
    argument vector whose depth corresponds to the template depth of the
    context in which the atomic constraint expression was written, instead
    of the highest parameter level that the expression happens to use.

            PR c++/104527

    gcc/cp/ChangeLog:

            * constraint.cc (normalize_atom): Set
            ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P appropriately.
            (get_mapped_args):  Make static, adjust parameters.  Always
            return a vector whose depth corresponds to the template depth of
            the context of the atomic constraint expression.  Micro-optimize
            by passing false as exact to safe_grow_cleared and by collapsing
            a multi-level depth-one argument vector.
            (satisfy_atom): Adjust call to get_mapped_args and
            diagnose_atomic_constraint.
            (diagnose_atomic_constraint): Replace map parameter with an args
            parameter.
            * cp-tree.h (ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P): Define.
            (get_mapped_args): Remove declaration.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-return-req4.C: New test.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-03-12 20:02 ` cvs-commit at gcc dot gnu.org
@ 2022-03-12 20:05 ` ppalka at gcc dot gnu.org
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-12 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] ICE:     |[11 Regression] ICE: tree
                   |tree check: accessed elt 1  |check: accessed elt 1 of
                   |of 'tree_vec' with 0 elts   |'tree_vec' with 0 elts in
                   |in hash, at                 |hash, at
                   |cp/constraint.cc:2486       |cp/constraint.cc:2486

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12 so far.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-03-12 20:05 ` [Bug c++/104527] [11 " ppalka at gcc dot gnu.org
@ 2022-04-21  7:51 ` rguenth at gcc dot gnu.org
  2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
  2023-05-22  3:13 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
@ 2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
  2023-05-22  3:13 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-22  3:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:9cfb9378b93c01a4afff5b330bb4adf4904edf62

commit r11-10800-g9cfb9378b93c01a4afff5b330bb4adf4904edf62
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Mar 12 15:00:40 2022 -0500

    c++: return-type-req in constraint using only outer tparms [PR104527]

    Here the template context for the atomic constraint has two levels of
    template parameters, but since it depends only on the innermost parameter
    T we use a single-level argument vector (built by get_mapped_args) during
    substitution into the atom.  We eventually pass this vector to
    do_auto_deduction as part of checking the return-type-requirement within
    the atom, but do_auto_deduction expects outer_targs to be a full set of
    arguments for sake of satisfaction.

    This patch fixes this by making get_mapped_args always return an
    argument vector whose depth corresponds to the template depth of the
    context in which the atomic constraint expression was written, instead
    of the highest parameter level that the expression happens to use.

            PR c++/104527

    gcc/cp/ChangeLog:

            * constraint.cc (normalize_atom): Set
            ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P appropriately.
            (get_mapped_args):  Make static, adjust parameters.  Always
            return a vector whose depth corresponds to the template depth of
            the context of the atomic constraint expression.  Micro-optimize
            by passing false as exact to safe_grow_cleared and by collapsing
            a multi-level depth-one argument vector.
            (satisfy_atom): Adjust call to get_mapped_args and
            diagnose_atomic_constraint.
            (diagnose_atomic_constraint): Replace map parameter with an args
            parameter.
            * cp-tree.h (ATOMIC_CONSTR_EXPR_FROM_CONCEPT_P): Define.
            (get_mapped_args): Remove declaration.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-return-req4.C: New test.

    (cherry picked from commit 9413bb55185b9e88d84e91d5145d59f9f83b884a)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/104527] [11 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486
  2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
@ 2023-05-22  3:13 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-22  3:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104527

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.4+

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-22  3:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 10:24 [Bug c++/104527] New: [11/12 Regression] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in hash, at cp/constraint.cc:2486 asolokha at gmx dot com
2022-02-14 11:55 ` [Bug c++/104527] " rguenth at gcc dot gnu.org
2022-02-14 16:16 ` jakub at gcc dot gnu.org
2022-02-14 16:23 ` ppalka at gcc dot gnu.org
2022-03-12 20:02 ` cvs-commit at gcc dot gnu.org
2022-03-12 20:05 ` [Bug c++/104527] [11 " ppalka at gcc dot gnu.org
2022-04-21  7:51 ` rguenth at gcc dot gnu.org
2023-05-22  3:12 ` cvs-commit at gcc dot gnu.org
2023-05-22  3:13 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).