This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/16187] extra casts to unsigned int generated for array references
- From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2004 22:47:51 -0000
- Subject: [Bug middle-end/16187] extra casts to unsigned int generated for array references
- References: <20040625001706.16187.dann@godzilla.ics.uci.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dann at godzilla dot ics dot uci dot edu 2004-06-25 22:47 -------
The cast to unsigned int is generated by c-common.c:pointer_int_sum
See the difference in the gimple code generated for the following 2 functions:
int f1(int * data, int j) | int f1(int * data, unsigned int j)
{ {
return data[j]; return data[j];
} }
j.1 = (unsigned int)j; | T.1 = j * 4;
T.2 = j.1 * 4; | T.2 = (int *)T.1;
T.3 = (int *)T.2; | T.3 = T.2 + data;
T.4 = T.3 + data; | T.0 = *T.3;
T.0 = *T.4; <
return T.0; return T.0;
The first case generates one extra gimple statement.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16187