> Do you *know* that char1, char2 are not both on appropriately-aligned > int boundaries? Sorry. That was a incorrect example. Consider this: struct st1{ char c1, c2, c3, c4, c5; } ob1; int main(void) { int *ip; ip = &ob1.c1; // c1 at 404100 in cygwin ip = &ob1.c2; // c2 at 404101 in cygwin } > misaligned accesses to ints are not prohibited on. e.g., x86. Right. No abort / bus error for misaligned int ptr (value) access. > It ain't a 68000, you know! Right. I get bus error for such misaligned int access. Thanks Bernard Leak for the information. Regards, Kannan ----------------------------------------------------------------- From: Bernard Leak [mailto:bernard@xxxxxxxxxxxxxxxxxx] Sent: Tuesday, March 05, 2013 2:31 AM To: gcc-help@xxxxxxxxxxx Cc: Mailaripillai, Kannan Jeganathan Subject: Re: no warning even with -Wcast-align in windows/hp-ux gcc-help.52314 (apologies if that doesn't thread properly...) >char char1; >char char2; >int *ip; >void foo(void) { > ip = &char1; // line 6 > *ip = 65; > ip = &char2; // line 8 > *ip = 66; > return; >} >No alignment warning at line 6, 8. >Tried in windows (GCC 4.5.3), hp-ux (GCC 4.7.1). Um, why should there be an alignment warning? Do you *know* that char1, char2 are not both on appropriately-aligned int boundaries? Leaving aside the unofficial character of all Windows builds of GCC (are you using Cygwin or similar?), misaligned accesses to ints are not prohibited on. e.g., x86. It ain't a 68000, you know! On the other hand, I get a warning "assignment from incompatible pointer type", for each of the indicated lines, which is what I'd expect. Bernard Leak.