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

            Bug ID: 98721
           Summary: [11 Regression] ICE in c_tree_printer at
                    /gcc/c/c-objc-common.c:314 since
                    r11-5523-geafe8ee7af13c398
           Product: gcc
           Version: 11.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: ---

Since the revision, I see the following ICE:

$ cat strlen.i
long unsigned int strlen(const char *);

void test_char_vla_local(int n) {
  char vla[n];
  if (1 == strlen(vla)) {
    char vla[n];
  }
}

$ gcc strlen.i -c -fsanitize=undefined -fno-code-hoisting -O3
strlen.i: In function ‘test_char_vla_local’:
strlen.i:5:12: warning: ‘strlen’ reading 1 or more bytes from a region of size
0 [-Wstringop-overread]
    5 |   if (1 == strlen(vla)) {
      |            ^~~~~~~~~~~
‘
during RTL pass: expand
Segmentation fault
0xe6e37a crash_signal
        /home/marxin/Programming/gcc/gcc/toplev.c:327
0x8a9ee8 c_tree_printer
        /home/marxin/Programming/gcc/gcc/c/c-objc-common.c:314
0x8a9ee8 c_tree_printer
        /home/marxin/Programming/gcc/gcc/c/c-objc-common.c:254
0x1a43872 pp_format(pretty_printer*, text_info*)
        /home/marxin/Programming/gcc/gcc/pretty-print.c:1475
0x1a288a0 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        /home/marxin/Programming/gcc/gcc/diagnostic.c:1244
0x1a2bb87 diagnostic_impl
        /home/marxin/Programming/gcc/gcc/diagnostic.c:1406
0x1a2bb87 inform(unsigned int, char const*, ...)
        /home/marxin/Programming/gcc/gcc/diagnostic.c:1485
0x994e06 access_ref::inform_access(access_mode) const
        /home/marxin/Programming/gcc/gcc/builtins.c:4576
0x998aab check_access(tree_node*, tree_node*, tree_node*, tree_node*,
tree_node*, access_mode, access_data const*)
        /home/marxin/Programming/gcc/gcc/builtins.c:4889
0x9998c4 check_read_access
        /home/marxin/Programming/gcc/gcc/builtins.c:4909
0x9999c1 check_read_access
        /home/marxin/Programming/gcc/gcc/expr.h:282
0x9999c1 expand_builtin_strlen
        /home/marxin/Programming/gcc/gcc/builtins.c:3701
0x99ef2c expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        /home/marxin/Programming/gcc/gcc/builtins.c:9818
0xaf2c8d expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /home/marxin/Programming/gcc/gcc/expr.c:11275
0xafe0b0 store_expr(tree_node*, rtx_def*, int, bool, bool)
        /home/marxin/Programming/gcc/gcc/expr.c:5885
0xaff8cf expand_assignment(tree_node*, tree_node*, bool)
        /home/marxin/Programming/gcc/gcc/expr.c:5621
0x9c9046 expand_call_stmt
        /home/marxin/Programming/gcc/gcc/cfgexpand.c:2837
0x9c9046 expand_gimple_stmt_1
        /home/marxin/Programming/gcc/gcc/cfgexpand.c:3843
0x9c9046 expand_gimple_stmt
        /home/marxin/Programming/gcc/gcc/cfgexpand.c:4007
0x9cef5a expand_gimple_basic_block
        /home/marxin/Programming/gcc/gcc/cfgexpand.c:6044
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to