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

            Bug ID: 92373
           Summary: [10 Regression] ICE get_initializer_for at
                    gcc/tree.c:13553 since r277728
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

Following is cause ICE:

$ cat ice2.i
struct container {
  char data[1];
};

char a[6] = {};

int b;
int main() {
  struct container *p = (char*)a;
  b = p->data[4];
  return 0;
}

$ gcc ice2.i -c -O2 -Warray-bounds
ice2.i: In function ‘main’:
ice2.i:9:25: warning: initialization of ‘struct container *’ from incompatible
pointer type ‘char *’ [-Wincompatible-pointer-types]
    9 |   struct container *p = (char*)a;
      |                         ^
during GIMPLE pass: vrp
ice2.i:8:5: internal compiler error: tree check: expected constructor, have
string_cst in get_initializer_for, at tree.c:13553
    8 | int main() {
      |     ^~~~
0x73ad2a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/marxin/Programming/gcc/gcc/tree.c:9672
0x7429bc tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/marxin/Programming/gcc/gcc/tree.h:3267
0x7429bc get_initializer_for
        /home/marxin/Programming/gcc/gcc/tree.c:13553
0x10922dd component_ref_size(tree_node*, bool*)
        /home/marxin/Programming/gcc/gcc/tree.c:13663
0x106380c vrp_prop::check_array_ref(unsigned int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:4189
0x1066017 vrp_prop::check_array_ref(unsigned int, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:4151
0x1066017 check_array_bounds
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:4702
0x109bcc3 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*> >*))
        /home/marxin/Programming/gcc/gcc/tree.c:11942
0xb1650d walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        /home/marxin/Programming/gcc/gcc/gimple-walk.c:202
0x105d360 check_array_bounds_dom_walker::before_dom_children(basic_block_def*)
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:4760
0x1629717 dom_walker::walk(basic_block_def*)
        /home/marxin/Programming/gcc/gcc/domwalk.c:309
0x10614fe vrp_prop::check_all_array_refs()
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:4777
0x1068216 vrp_prop::vrp_finalize(bool)
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:6803
0x106f2fc execute_vrp
        /home/marxin/Programming/gcc/gcc/tree-vrp.c:6871
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Reply via email to