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

            Bug ID: 71239
           Summary: [7 Regression] ICE in operand_equal_p
                    (fold-const.c:2769)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Starting from r236557, we ICE on following code:

class A;
template <long Length> class B {
  A mArr[Length];

public:
  A &operator[](long aIndex) { return mArr[aIndex]; }
};
class A {
public:
  operator int *() {
    int *a = mRawPtr;
    return a;
  }
  int *mRawPtr;
};
extern B<0> b;
void fn1() {
  if (b[long(fn1)])
    new int;
}

$/xgcc -B. tc.ii -Os -Wall -c


/home/marxin/BIG/buildbot/slave/source/firefox/obj-x86_64-pc-linux-gnu/netwerk/base/tc.ii:17:6:
internal compiler error: Segmentation fault
 void fn1() {
      ^~~
0x111b710 crash_signal
        ../../gcc/toplev.c:333
0xd349cc operand_equal_p(tree_node const*, tree_node const*, unsigned int)
        ../../gcc/fold-const.c:2769
0xd348f1 operand_equal_p(tree_node const*, tree_node const*, unsigned int)
        ../../gcc/fold-const.c:2751
0x14732ca array_at_struct_end_p(tree_node*)
        ../../gcc/tree.c:13100
0x14355c0 check_array_ref
        ../../gcc/tree-vrp.c:6427
0x1436190 check_array_bounds
        ../../gcc/tree-vrp.c:6589
0x146e089 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/tree.c:11650
0x146f6ae 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/tree.c:11967
0xdcd5d7 walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.c:203
0x1436374 check_all_array_refs
        ../../gcc/tree-vrp.c:6636
0x1441378 vrp_finalize
        ../../gcc/tree-vrp.c:10202
0x14414c0 execute_vrp
        ../../gcc/tree-vrp.c:10295
0x14417bb execute
        ../../gcc/tree-vrp.c:10380

The problem is that we call operand_equal_p with one argument equal to NULL.

Martin

Reply via email to