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

            Bug ID: 84238
           Summary: [8 Regression] ICE tree check: expected integer_cst,
                    have plus_expr in to_wide, at tree.h:5527
           Product: gcc
           Version: unknown
            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: ---

Starting from r256457 we ICE on:

$ cat ice.i
char a[1];
int b;
char *strncpy (char *, char *, long);
void
c ()
{
  char d[b];
  strncpy (a, &d[3], 3);
}

$ gcc -O2 -g ice.i
during GIMPLE pass: strlen
ice.i: In function ā€˜c’:
ice.i:5:1: internal compiler error: tree check: expected integer_cst, have
plus_expr in to_wide, at tree.h:5527
 c ()
 ^
0x5c76a6 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9325
0x6fbce5 tree_check(tree_node const*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3388
0x6fbce5 wi::to_wide(tree_node const*)
        ../../gcc/tree.h:5527
0x6fbce5 wi::to_wide(tree_node const*, unsigned int)
        ../../gcc/tree.h:5538
0xdc8180 maybe_diag_stxncpy_trunc
        ../../gcc/tree-ssa-strlen.c:1905
0xdc8b52 handle_builtin_stxncpy
        ../../gcc/tree-ssa-strlen.c:2076
0xdcc05f strlen_check_and_optimize_stmt
        ../../gcc/tree-ssa-strlen.c:3139
0xdcc05f strlen_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/tree-ssa-strlen.c:3472
0x13851b7 dom_walker::walk(basic_block_def*)
        ../../gcc/domwalk.c:353
0xdc64a7 execute
        ../../gcc/tree-ssa-strlen.c:3552
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