public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011
@ 2021-12-14  7:15 asolokha at gmx dot com
  2021-12-14 10:15 ` [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2021-12-14  7:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103704
           Summary: [12 Regression] ICE: tree check: expected class
                    'type', have 'exceptional' (tree_vec) in
                    operand_equal_p, at fold-const.c:3011
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++ 12.0.0 20211212 snapshot (g:0b52083ea2c2dd9897031fdc3802a68fd4aa45ef) ICEs
when compiling the following testcase, reduced from
test/OpenMP/distribute_ast_print.cpp from the clang 13.0.0 test suite, w/
-fopenmp:

struct S {
  int a;
  typedef int type;
};

template <typename T>
class S7 : public T {
protected:
  T a;

public:
  S7() {
#pragma omp target
#pragma omp teams
#pragma omp distribute private(a)
    for (int k = 0; k < 1; ++k)
      ;
  }
};

struct S8 : public S7<S> {
  S8() : S7<S>() {}
};

% g++-12.0.0 -fopenmp -c wrzv9p97.cpp
wrzv9p97.cpp: In instantiation of 'S7<T>::S7(typename T::type) [with T = S;
typename T::type = int]':
wrzv9p97.cpp:22:22:   required from here
wrzv9p97.cpp:13:9: internal compiler error: tree check: expected class 'type',
have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011
   13 | #pragma omp target
      |         ^~~
0x867963 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:8752
0x78ad2a tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.h:3564
0x78ad2a operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:3011
0xe00d30 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:3970
0xe00d30 operand_compare::verify_hash_value(tree_node const*, tree_node const*,
unsigned int, bool*)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:3956
0xe00d30 operand_compare::verify_hash_value(tree_node const*, tree_node const*,
unsigned int, bool*)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:3948
0xe016d8 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:2965
0xe016d8 operand_equal_p(tree_node const*, tree_node const*, unsigned int)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/fold-const.c:3987
0xb89dee finish_omp_target_clauses_r
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/semantics.c:9332
0x14820e2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:11084
0x14822fd walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:11315
0x14823ce walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:11199
0x14822fd walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:11315
0x14855ea 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<tree_node*, false,
default_hash_traits<tree_node*> >*))
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree.c:11341
0xb78ef5 finish_omp_target_clauses(unsigned int, tree_node*, tree_node**)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/semantics.c:9431
0xb2e5a8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/pt.c:18980
0xb2bd7b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/pt.c:18582
0xb2c18a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/pt.c:18211
0xb2c18a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/pt.c:18225
0xb2bd7b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/cp/pt.c:18582

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

* [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c
  2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
@ 2021-12-14 10:15 ` marxin at gcc dot gnu.org
  2021-12-14 14:18 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-14 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|[12 Regression] ICE: tree   |[12 Regression] ICE: tree
                   |check: expected class       |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(tree_vec) in               |(tree_vec) in
                   |operand_equal_p, at         |operand_equal_p, at
                   |fold-const.c:3011           |fold-const.c:3011 since
                   |                            |r12-5835-g0ab29cf0bb68960c
                 CC|                            |cltang at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2021-12-14
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-5835-g0ab29cf0bb68960c.

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

* [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c
  2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
  2021-12-14 10:15 ` [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c marxin at gcc dot gnu.org
@ 2021-12-14 14:18 ` jakub at gcc dot gnu.org
  2021-12-14 14:43 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-14 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
           Priority|P3                          |P1
                 CC|                            |jakub at gcc dot gnu.org

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

* [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c
  2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
  2021-12-14 10:15 ` [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c marxin at gcc dot gnu.org
  2021-12-14 14:18 ` jakub at gcc dot gnu.org
@ 2021-12-14 14:43 ` jakub at gcc dot gnu.org
  2021-12-15  9:29 ` cvs-commit at gcc dot gnu.org
  2021-12-15  9:57 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-14 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51998
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51998&action=edit
gcc12-pr103704.patch

operand_equal_p in checking mode attempts to compute hashes and is unhappy
about OMP_CLAUSE abusing TREE_TYPE of it for the ctor/dtor etc. info.

Easiest seems to be for OMP_CLAUSE to just walk subtrees but not the OMP_CLAUSE
itself.  The walking of the body seems quite dangerous even with that change
though, but don't have a testcase that proves a problem though.

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

* [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c
  2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2021-12-14 14:43 ` jakub at gcc dot gnu.org
@ 2021-12-15  9:29 ` cvs-commit at gcc dot gnu.org
  2021-12-15  9:57 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-15  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c0e34451ae582c901a2df08498b36f68ae401f0a

commit r12-5992-gc0e34451ae582c901a2df08498b36f68ae401f0a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Dec 15 10:27:08 2021 +0100

    openmp: Avoid calling operand_equal_p on OMP_CLAUSEs [PR103704]

    On OMP_CLAUSEs we reuse TREE_TYPE as CP_OMP_CLAUSE_INFO in the C++ FE.
    This confuses the hashing code that operand_equal_p does when checking.
    There is really no reason to compare OMP_CLAUSEs against expressions
    like captured this, they will never compare equal.

    2021-12-15  Jakub Jelinek  <jakub@redhat.com>

            PR c++/103704
            * semantics.c (finish_omp_target_clauses_r): For OMP_CLAUSEs
            just walk subtrees.

            * g++.dg/gomp/pr103704.C: New test.

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

* [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c
  2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2021-12-15  9:29 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15  9:57 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-15  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-12-15  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14  7:15 [Bug c++/103704] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 asolokha at gmx dot com
2021-12-14 10:15 ` [Bug c++/103704] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (tree_vec) in operand_equal_p, at fold-const.c:3011 since r12-5835-g0ab29cf0bb68960c marxin at gcc dot gnu.org
2021-12-14 14:18 ` jakub at gcc dot gnu.org
2021-12-14 14:43 ` jakub at gcc dot gnu.org
2021-12-15  9:29 ` cvs-commit at gcc dot gnu.org
2021-12-15  9:57 ` jakub 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).