This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
i686-pc-linux-gnu optimizer bug
- To: gcc-bugs at gcc dot gnu dot org
- Subject: i686-pc-linux-gnu optimizer bug
- From: "Thomas R. Truscott" <trt at cs dot duke dot edu>
- Date: Fri, 14 Apr 2000 12:14:22 -0400 (EDT)
GNU C version 2.96 20000410 (experimental) (i686-pc-linux-gnu)
mis-optimizes the "subr" routine below.
(So did 20000110, sorry for not reporting this earlier.)
With "gcc -O0" the value of "to" is the correct value 1,
with "gcc -O" the value of "to" is the incorrect value -1.
Tom Truscott
===========
void
subr (char *src, char *dst)
{
*dst = !!(*src & 0x80);
}
int
main()
{
char from, to;
from = (char)0x80;
subr (&from, &to);
if (to != 1)
abort ();
return 0;
}