This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Why convert to pointer type before added to a pointer
- From: Jie Zhang <zhangjie at magima dot com dot cn>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 16 Aug 2004 18:03:22 +0800
- Subject: 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