This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29725] New: (signed char) to (signed int) typecast missbehaves
- From: "stian at nixia dot no" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Nov 2006 14:53:54 -0000
- Subject: [Bug c/29725] New: (signed char) to (signed int) typecast missbehaves
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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
--
Summary: (signed char) to (signed int) typecast missbehaves
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stian at nixia dot no
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29725