Why convert to pointer type before added to a pointer

Jie Zhang zhangjie@magima.com.cn
Mon Aug 16 10:25:00 GMT 2004


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



More information about the Gcc mailing list