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

            Bug ID: 124373
           Summary: array_ref_low_bound
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeng2401 at gmail dot com
  Target Milestone: ---

code:
#include <stdlib.h>
#define _Bool bool
__attribute__((noinline)) void x(void);
void (*f[2])(void) = {&x, &x};
__attribute__((noinline)) void x(void) { f[0](); }
int main() {
    __asm__("nop");
    x();
   }
void f(void) {
}

long long x(const int *p);

int x(const int *p);

====================================================================================================
   - compiler version:gcc (GCC) 13.1.0

   /root/gcc-build/gcc-13.1.0-install/bin/gcc -x c -O2 -c
/root/autodl-tmp/outputs/full_run/c12/123657.fuzz -o /tmp/fuzz_compile_out 2>&1

--------------------------------------------------------------------------------
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:11:6: error: ‘f’
redeclared as different kind of symbol
   11 | void f(void) {
      |      ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:5:8: note: previous
definition of ‘f’ with type ‘void (*[2])(void)’
    5 | void (*f[2])(void) = {&x, &x};
      |        ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:14:11: error:
conflicting types for ‘x’; have ‘long long int(const int *)’
   14 | long long x(const int *p);
      |           ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:6:32: note: previous
definition of ‘x’ with type ‘void(void)’
    6 | __attribute__((noinline)) void x(void) { f[0](); }
      |                                ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:16:5: error:
conflicting types for ‘x’; have ‘int(const int *)’
   16 | int x(const int *p);
      |     ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:6:32: note: previous
definition of ‘x’ with type ‘void(void)’
    6 | __attribute__((noinline)) void x(void) { f[0](); }
      |                                ^
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz: In function ‘x’:
/root/autodl-tmp/Fuzz4All/outputs/full_run/c12/123657.fuzz:6:43: internal
compiler error: tree check: expected array_type, have error_mark in
array_ref_low_bound, at tree.cc:12754
    6 | __attribute__((noinline)) void x(void) { f[0](); }
      |                                          ~^~~
0x23ab9c2 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc-13.1.0-src/gcc/tree.cc:8881
0xc3177e tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc-13.1.0-src/gcc/tree.h:3540
0x23c71b6 array_ref_low_bound(tree_node*)
        ../../gcc-13.1.0-src/gcc/tree.cc:12754
0x1540b03 gimplify_compound_lval
        ../../gcc-13.1.0-src/gcc/gimplify.cc:3219
0x15a361c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:16328
0x1543c52 gimplify_call_expr
        ../../gcc-13.1.0-src/gcc/gimplify.cc:3711
0x15a374a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:16348
0x1559a37 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:7219
0x15363f6 gimplify_bind_expr
        ../../gcc-13.1.0-src/gcc/gimplify.cc:1430
0x15a4ec7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:16577
0x1559a37 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:7219
0x15abad6 gimplify_body(tree_node*, bool)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:17638
0x15acc9e gimplify_function_tree(tree_node*)
        ../../gcc-13.1.0-src/gcc/gimplify.cc:17837
0x10ea9a6 cgraph_node::analyze()
        ../../gcc-13.1.0-src/gcc/cgraphunit.cc:684
0x10ee6bd analyze_functions
        ../../gcc-13.1.0-src/gcc/cgraphunit.cc:1247
0x10f4b71 symbol_table::finalize_compilation_unit()
        ../../gcc-13.1.0-src/gcc/cgraphunit.cc:2554
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.
--------------------------------------------------------------------------------
====================================================================================================

Reply via email to