This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/19100] New: Wrong code for ?-operator with casted ?-operator predicat


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]