[Bug tree-optimization/51990] New: ICE in copy_reference_ops_from_ref

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 25 08:45:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51990

             Bug #: 51990
           Summary: ICE in copy_reference_ops_from_ref
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vries@gcc.gnu.org


example test.c, based on gcc.c-torture/compile/20030224-1.c. Added pure to foo
and used result of foo to trigger visit_reference_op_call:
...
int
zzz (char *s1, char *s2, int len, int *q)
{
  int z = 5;
  unsigned int i,  b;
  struct s { char a[z]; };
  struct s x; 

  extern int foo (struct s, struct s) __attribute__((pure));

  for (i = 0; i < len; i++)
    s1[i] = s2[i];

  b = z & 0x3;

  len += (b == 0 ? 0 : 1) + z;

  *q = len;

  return foo (x, x);
}
...

compile ICEs with trunk r183325:
...
$ gcc -O2 test.c -S
test.c: In function ‘zzz’:
test.c:21:1: internal compiler error: in copy_reference_ops_from_ref, at
tree-ssa-sccvn.c:738
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
...

backtrace:
...
(gdb) bt
#0  exit (status=4) at exit.c:49
#1  0x0000000001f15ebb in diagnostic_action_after_output (context=0x2730620,
diagnostic=0x7fffffffd3e0) at /home/vries/devel/src/gcc/diagnostic.c:243
#2  0x0000000001f16d8d in diagnostic_report_diagnostic (context=0x2730620,
diagnostic=0x7fffffffd3e0) at /home/vries/devel/src/gcc/diagnostic.c:552
#3  0x0000000001f17dac in internal_error (gmsgid=0x225a7a7 "in %s, at %s:%d")
at /home/vries/devel/src/gcc/diagnostic.c:845
#4  0x0000000001f17f34 in fancy_abort (file=0x2043eb0
"/home/vries/devel/src/gcc/tree-ssa-sccvn.c", line=738, function=0x2045000
"copy_reference_ops_from_ref") at /home/vries/devel/src/gcc/diagnostic.c:899
#5  0x0000000000ef9dd8 in copy_reference_ops_from_ref (ref=0x7ffff565eba0,
result=0x271b1d8) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:738
#6  0x0000000000efaae1 in copy_reference_ops_from_call (call=0x7ffff554a720,
result=0x271b1d8) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:951
#7  0x0000000000efc906 in valueize_shared_reference_ops_from_call
(call=0x7ffff554a720) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:1272
#8  0x0000000000f018b4 in visit_reference_op_call (lhs=0x7ffff5664a00,
stmt=0x7ffff554a720) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:2596
#9  0x0000000000f04359 in visit_use (use=0x7ffff5664a00) at
/home/vries/devel/src/gcc/tree-ssa-sccvn.c:3364
#10 0x0000000000f04b5f in process_scc (scc=0x27493f0) at
/home/vries/devel/src/gcc/tree-ssa-sccvn.c:3505
#11 0x0000000000f052a0 in extract_and_process_scc_for_name
(name=0x7ffff5664a00) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:3589
#12 0x0000000000f05466 in DFS (name=0x7ffff5664a00) at
/home/vries/devel/src/gcc/tree-ssa-sccvn.c:3643
#13 0x0000000000f06028 in run_scc_vn (default_vn_walk_kind_=VN_WALKREWRITE) at
/home/vries/devel/src/gcc/tree-ssa-sccvn.c:3892
#14 0x0000000000ee1f38 in execute_pre (do_fre=1 '\001') at
/home/vries/devel/src/gcc/tree-ssa-pre.c:4870
#15 0x0000000000ee2192 in execute_fre () at
/home/vries/devel/src/gcc/tree-ssa-pre.c:4988
...


Cause of ICE: unhandled WITH_SIZE_EXPR in switch (temp.opcode):
...
#5  0x0000000000ef9dd8 in copy_reference_ops_from_ref (ref=0x7ffff565eba0,
result=0x271b1d8) at /home/vries/devel/src/gcc/tree-ssa-sccvn.c:738
738          gcc_unreachable ();
(gdb) call debug_generic_expr (ref)
WITH_SIZE_EXPR <*x.1_20, 5>
...

20030224-1.c.027t.esra (dump before 20030224-1.c.028t.fre1):
...
zzz (char * s1, char * s2, int len, int * q)
{
  <unnamed-unsigned:8> D.1744[5];
  unsigned int i;
  void * saved_stack.4;
  int D.1739;
  unsigned int len.2;
  char D.1733;
  char * D.1732;
  char * D.1731;
  sizetype D.1730;
  struct s * x.1;
  sizetype D.1724;

<bb 2>:
  saved_stack.4_2 = __builtin_stack_save ();
  D.1724_19 = 5;
  x.1_20 = &D.1744;
  i_21 = 0;
  goto <bb 4>;

<bb 3>:
  D.1730_24 = (sizetype) i_1;
  D.1731_26 = s1_25(D) + D.1730_24;
  D.1730_27 = (sizetype) i_1;
  D.1732_29 = s2_28(D) + D.1730_27;
  D.1733_30 = *D.1732_29;
  *D.1731_26 = D.1733_30;
  i_31 = i_1 + 1;

<bb 4>:
  # i_1 = PHI <0(2), i_31(3)>
  len.2_23 = (unsigned int) len_22(D);
  if (len.2_23 > i_1)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 5>:
  len_37 = len_22(D) + 6;
  *q_38(D) = len_37;
  D.1739_39 = foo (WITH_SIZE_EXPR <*x.1_20, 5>, WITH_SIZE_EXPR <*x.1_20, 5>);
  D.1744 ={v} {CLOBBER};
  __builtin_stack_restore (saved_stack.4_2);
  return D.1739_39;

}
...



More information about the Gcc-bugs mailing list