[Bug tree-optimization/26726] -fivopts producing out of bounds array refs

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 17 11:39:00 GMT 2006



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-03-17 11:39 -------
Reduced testcase:

struct QValueList {
    QValueList() { sh = new int; }
    void foo();
    int* sh;
};

void queryIconsByContext()
{
    QValueList iconlist[8];
    iconlist[7].foo();
}

ivopts generates

<bb 2>:
  ivtmp.35_3 = &iconlist[1];

  # ivtmp.35_12 = PHI <ivtmp.35_17(4), ivtmp.35_3(2)>;
<L0>:;
  D.2027_8 = operator new (4);
  D.2028_9 = (int *) D.2027_8;
  D.2072_4 = (int * *) &iconlist[0];
  D.2073_7 = (int * *) ivtmp.35_12;
  D.2074_21 = D.2072_4 + D.2073_7;
  D.2075_22 = -&iconlist;
  D.2076_23 = (int * *) D.2075_22;
  MEM[base: D.2074_21, index: D.2076_23, offset: -4B] = D.2028_9;
  ivtmp.35_17 = ivtmp.35_12 + 4B;
  if (ivtmp.35_17 != &iconlist[9]) goto <L5>; else goto <L2>;

<L5>:; 
  goto <bb 3> (<L0>);

both using -&iconlist (!?) as index and and -4 as offset for TMR looks weird
here.  Referencing &iconlist[9] is sort of wrong-code.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-17 11:39:44
               date|                            |


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



More information about the Gcc-bugs mailing list