Bug 213821

Summary: Incorrect result from conditional expression
Product: [Fedora] Fedora Reporter: Ralph Loader <suckfish>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.1.1-32 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-05 13:02:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralph Loader 2006-11-03 07:32:51 UTC
Description of problem:

The following program prints

128
-128

I believe that it should print 128 both times.
--------------------------
#include <stdio.h>

int main (int argc, const char ** argv)
{
    int a = 128;
    printf ("%d\n", (a & 0x80) ? 0x80 : 0);
    unsigned char b = 128;
    printf ("%d\n", (b & 0x80) ? 0x80 : 0);
    return 0;
}
--------------------------

Version-Release number of selected component (if applicable):

gcc-4.1.1-31

How reproducible:

Every time.

Comment 1 Jakub Jelinek 2006-11-05 13:02:44 UTC
Fixed in gcc-4.1.1-32 in rawhide.