The function test returns 17 not 18 as required.

#include <stdio.h>

signed char test(long v[]){
 return ( ( ((signed char) (v[1] ?  0x100 : 0 ))) ?  17 : 18); 
}
    
int main(void){
        static long v[3];
        v[1]=2;
        printf("test : %d\n",test(v));
        return 0; 
}

-- 
           Summary: Wrong code for ?-operator with casted ?-operator
                    predicat
           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-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19100

Reply via email to