Ian Lance Taylor wrote:
There should be a warning here. The warning code is confused by the
double cast. If you cast directly to short *, you should get the
warning.
I'm going to test this patch to fix this problem. Anybody see
anything wrong with it?
Hi,
Thank you for your quick reply. Your patch has been very helpful. It
doesn't seem to catch these similar cases, though:
int main() {
int a = 1;
void *p1 = (void *) &a;
* (short *) p1 = 2;
char *p2 = (char *) &a;
* (short *) p2 = 3;
return a;
}
This still returns 1 without a warning. (I am now using 4.1.0-20050723,
so that I could try your patch.)