This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/20187] New: wrong code for ((unsigned char)(unsigned long long)((a?a:1)&(a*b)))?0:1)
- From: "heinrich dot brand at fujitsu-siemens dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2005 12:05:09 -0000
- Subject: [Bug middle-end/20187] New: wrong code for ((unsigned char)(unsigned long long)((a?a:1)&(a*b)))?0:1)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Function test has value 0. Should have value 1;
#include <stdio.h>
int a=0x101;
int b=0x100;
int test(){
return (
((unsigned char)(unsigned long long) ( (a?a:1) & (a*b) ))
? 0 : 1 );
}
int main(void){
if((unsigned char)(unsigned long long) (a&(a*b)))return 2;
if( test() ){
printf("successful\n"); return 0;
} else {
printf("failed\n"); return 1;
}
}
Related to Bug 19606?
GNU CPP version 2.95.2 19991024 (release) (sparc) successful
GNU C version 3.3.3 (sparc-sun-solaris2.8) failed
GNU CPP version 3.2 (cpplib) (i386 Linux/ELF) failed
GNU C version 3.3.2 (i686-pc-linux-gnu) failed
GNU C version 3.3.5 (i686-pc-linux-gnu) failed
GNU C version 3.4.3 (i686-pc-linux-gnu) failed
--
Summary: wrong code for ((unsigned char)(unsigned long
long)((a?a:1)&(a*b)))?0:1)
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: heinrich dot brand at fujitsu-siemens dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20187