Issue Details (XML | Word | Printable)

Key: PCC-384
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Anders Magnusson
Reporter: D C Gosnell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

Bug with bitshifting operation

Created: 23/Dec/11 03:47 PM   Updated: 24/Dec/11 12:03 PM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File pccbug.c (0.1 kB)

Environment:
Linux 2.6.31-21-generic-pae #59-Ubuntu SMP Wed Mar 24 08:47:55 UTC 2010 i686 GNU/Linux
pcc compiled with gcc 4.4.1


 Description  « Hide
The following program produces the output "IT'S 2", when I would expect "IT'S 0"

#include <stdio.h>

int main()
{
    int g = 0, b = 0, s = 0;
    long l = (g/2) | ((b/2)<<s);
    printf("IT'S %lx\n", l);
}


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson made changes - 23/Dec/11 05:36 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson made changes - 24/Dec/11 12:03 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]