This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/12676] m68k.c: LP64 bug


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12676


matt at 3am-software dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|m68k.c: L64 bug             |m68k.c: LP64 bug


------- Additional Comments From matt at 3am-software dot com  2003-10-19 02:31 -------
alpha is a LP64 platform so that unsigned != unsigned HOST_WIDE_INT
unsigned int != unsigned long

Here's a small snippet that shows the code fragment as it's run on an
Alpha (gcc3.3.1):

matt@cs20> cc -O2 -o x x.c -DTYPE=int && ./x
-65536 = 0
-65535 = 0
-32768 = 0
-32767 = 0
-1     = 1
matt@cs20> cc -O2 -o x x.c -DTYPE=long && ./x
-65536 = 1
-65535 = 1
-32768 = 0
-32767 = 0
-1     = 1
matt@cs20> more x.c
int
f(long v)
{
    if (v + 0x8000 >= (unsigned TYPE) 0x1000)
        return 1;
    return 0;
}



main(void)
{
        printf("-65536 = %d\n", f(-65536));
        printf("-65535 = %d\n", f(-65535));
        printf("-32768 = %d\n", f(-32768));
        printf("-32767 = %d\n", f(-32767));
        printf("-1     = %d\n", f(-1    ));
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]