Bug report (bis)
Olivier Baudron
Olivier.Baudron@ens.fr
Sat Mar 20 16:11:00 GMT 1999
A shorter program showing the bug is:
essai2.c:
/* ----------------------- CUT HERE -------------------------- */
#include <stdio.h>
void in_cksum(short *w) {
short answer = 0;
*(char *)(&answer) = *(char *)w ;
printf ("answer=%hu\n", answer);
}
int main (int argc, char **argv) {
short a[1]={0};
in_cksum (a);
return 0;
}
/* ----------------------- CUT HERE -------------------------- */
and the result:
% gcc -Wall -o essai2 essai2.c && essai2
answer=0
% gcc -O2 -Wall -o essai2 essai2.c && essai2
answer=63488
More information about the Gcc-bugs
mailing list