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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-20 
13:21:23 UTC ---
I think it goes wrong when folding during inlining of ustr_len.

  D.2729_11 = xi1_6 + 1;
  switch (xi2_9) <default: <L5>, case 0: <L6>, case 1: <L4>, case 2: <L3>, case
4: <L2>, case 8: <L1>>
...
<L4>:
  D.2772_47 = MEM[(const unsigned char *)s1_1(D)].data[D.2729_11]{lb: 0 sz: 1};

at runtime xi1_6 is zero.  After inlining we get

  D.2830_13 = xi1_9 + 1;
  switch (xi2_12) <default: <L7>, case 0: <L8>, case 1: <L6>, case 2: <L5>,
case 4: <L4>, case 8: <L3>>
...
  # ret_45 = PHI <0(2), ret_42(5)>
<L6>:
  D.2828_43 = 1;

but we are called with s1_1 = "\1\2s2" so somehow the offset from the array
ref around the MEM is ignored.

Reply via email to