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

            Bug ID: 110699
           Summary: internal compiler error: tree check: expected
                    array_type, have error_mark in array_ref_low_bound, at
                    tree.cc:12754
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compiling below program using gcc-14 with option `gcc-14 a.c`, gcc-14
crashes:
```
typedef __attribute__((__vector_size__(64))) int T;

void f(void) {
  extern char a[64], b[64];
  void *p = a;
  T q = *(T *)&b[0];
}

void g() {
  extern char b;
}
```

GCC's output is pasted below:
```
<source>: In function 'g':
<source>:10:15: error: conflicting types for 'b'; have 'char'
   10 |   extern char b;
      |               ^
<source>:4:22: note: previous declaration of 'b' with type 'char[64]'
    4 |   extern char a[64], b[64];
      |                      ^
<source>: In function 'f':
<source>:6:17: internal compiler error: tree check: expected array_type, have
error_mark in array_ref_low_bound, at tree.cc:12754
    6 |   T q = *(T *)&b[0];
      |                ~^~~
0x215104e internal_error(char const*, ...)
        ???:0
0x896b1b tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xd6c895 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6d557 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6db1d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6cf6a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7053a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6d53e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7053a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6e4ab gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7053a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd6d914 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd7053a gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd719d3 gimplify_body(tree_node*, bool)
        ???:0
0xd71e2f gimplify_function_tree(tree_node*)
        ???:0
0xbaeba7 cgraph_node::analyze()
        ???:0
0xbb26f1 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```

This can be verified by visiting the Compiler Explorer:
https://gcc.godbolt.org/z/jPhnfG4f3

Reply via email to