This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/24517] New: casting problem
- From: "Wojciech dot Skaba at teleadreson dot com dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2005 12:13:54 -0000
- Subject: [Bug c/24517] New: casting problem
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
#include <stdio.h>
unsigned char mem[] = "1234567890";
unsigned char *memptr= mem;
unsigned char cc;
unsigned long donothing(unsigned long a, short c)
{ return(a);
}
int main(void)
{
*memptr++ = (unsigned char)donothing(*memptr, 0);
if ('1'==mem[0]) puts("Good compiler");
else puts("Bad compiler");
// now the same via cc
mem[0] = '1';
memptr = mem;
cc = (unsigned char)donothing(*memptr, 0);
*memptr++ = cc;
if ('1'==mem[0]) puts("Good compiler");
else puts("Bad compiler");
}
--
Summary: casting problem
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Wojciech dot Skaba at teleadreson dot com dot pl
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24517