Bug 213821 - Incorrect result from conditional expression
Incorrect result from conditional expression
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-03 02:32 EST by Ralph Loader
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 4.1.1-32
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-11-05 08:02:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Ralph Loader 2006-11-03 02:32:51 EST
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 08:02:44 EST
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.