Subject: bin/26456: cc generates broken object code
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <nis@harl.hitachi.co.jp>
List: netbsd-bugs
Date: 07/27/2004 22:53:08
>Number:         26456
>Category:       bin
>Synopsis:       cc generates broken object code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 28 01:18:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Shingo Nishioka
>Release:        2.0_BETA
>Organization:
CRL, Hitachi Ltd.
>Environment:
NetBSD pc3.harl.hitachi.co.jp. 2.0_BETA NetBSD 2.0_BETA (PC3) #0: Sat Jul 17 08:34:13 JST 2004  nis@pc3:/usr/obj/sys/arch/i386/compile/PC3 i386
>Description:
cc generates broken object code on certain program.

>How-To-Repeat:
$ cat i.c
#include <sys/types.h>

#include <stdio.h>

main()
{
        char c = -128;

        printf("c ==> %d\n", c);
        printf("(unsigned short) c ==> %d\n",
                (unsigned short) c);
        printf("(unsigned short) c > 1 ==> %d --- (should be 1)\n",
                (unsigned short) c > 1);
        return 0;
}
$ cc --version
cc (GCC) 3.3.3 (NetBSD nb3 20040520)
Copyright (C) 2003 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cc i.c
$ ./a.out
c ==> -128
(unsigned short) c ==> 65408
(unsigned short) c > 1 ==> 0 --- (should be 1)

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: