This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/33122] Mistaken type mismatch error prevents bootstrap



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-08-20 15:30 -------
Reduced testcase:

struct dis386 {
  const char *x;
};

static const struct dis386 float_reg[][2] = {
  { { "fadd" }, { "fadd" } },
};

void foo(int i, int j)
{
  const struct dis386 *dp;

  dp = &float_reg[i - 1][j];
}

Note that with &float_reg[i][j] it works just fine.  The fronted generates

  dp = &float_reg + (((long unsigned int) ((long unsigned int) i * 2) + (long
unsigned int) (long unsigned int) j) * 8 + 0xfffffffffffffffffffffffffffffff0);

which has a missing conversion to (struct dis386 *).  Without the
subtraction in the first array ref we get

  dp = (struct dis386 *) &float_reg + ((long unsigned int) ((long unsigned int)
i * 2) + (long unsigned int) (long unsigned int) j) * 8;

instead, which is correct.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|bootstrap                   |c
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-20 15:30:51
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]