This is the mail archive of the gcc@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]

Why convert to pointer type before added to a pointer


This simple code

void
foo (int* a, int n)
{
  a[n] = 1;
}

is transformed into

foo (a, n)
{
  unsigned int n.0;
  unsigned int T.1;
  int * T.2;
  int * T.3;

  n.0 = (unsigned int)n;
  T.1 = n.0 * 4;
  T.2 = (int *)T.1;      <== Why this converting
  T.3 = T.2 + a;
  *T.3 = 1;
}

after the genericizing. Thanks.

cheers
--
Jie


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