Bug 29725 - (signed char) to (signed int) typecast missbehaves
Summary: (signed char) to (signed int) typecast missbehaves
Status: RESOLVED DUPLICATE of bug 27639
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.1.1
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-05 14:53 UTC by stian
Modified: 2006-11-06 20:25 UTC (History)
10 users (show)

See Also:
Host: i686-pc-linux
Target: i686-pc-linux
Build: i686-pc-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stian 2006-11-05 14:53:53 UTC
The following code-snippest generate wrong numbers with gcc 4.1.1 using -O, -O1 and -O2.

#include <stdio.h>
int main(int arg, char *argv[])
{
        int j;
        for (j=0; j<256; j++)
        {
                signed char j2=(signed char)j;
                printf("%d\n", (signed int)j2);
        }
        return 0;
}


http://bugs.gentoo.org/show_bug.cgi?id=154079
Comment 1 Richard Biener 2006-11-05 16:11:58 UTC
This is fixed already.
Comment 2 stian 2006-11-05 16:51:43 UTC
But no releases that fixes this issue has been released in the 4.1.x serie as far as I can see atleast.

Comment 3 Andrew Pinski 2006-11-06 20:25:34 UTC

*** This bug has been marked as a duplicate of 27639 ***