This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Optimization Bug with gcc 2.95.1
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Optimization Bug with gcc 2.95.1
- From: Attila Roemer <roemer at ifn dot et dot tu-dresden dot de>
- Date: Mon, 20 Sep 1999 17:41:49 +0200
There seems to be a optimization bug in gcc 2.95.1.
For instance the following program does not get the same
results
with -O (or -O2) and -O3 (or nothing).
-- Attila
#include <stdio.h>
/* If one=1, then the output should be: bit&1 */
unsigned test(unsigned one , unsigned bit)
{
unsigned val= bit & 1;
unsigned zero= one >> 1;
val++;
return zero + ( val>> 1 );
}
int main()
{
printf("ret=%d\n", test(1,0)); /* should print 0 */
printf("ret=%d\n", test(1,1)); /* should print 1 */
printf("ret=%d\n", test(1,65535)); /* should print 1 */
return 0;
}