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

  • [Bug c/24517] New: casti... Wojciech dot Skaba at teleadreson dot com dot pl

Reply via email to