Bug 213821 - Incorrect result from conditional expression
Summary: Incorrect result from conditional expression
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-03 07:32 UTC by Ralph Loader
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 4.1.1-32
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-11-05 13:02:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.