[gnu.gcc.bug] gcc 1.28 bug -- short to long

pme@ra.umb.edu (Paul English) (10/08/88)

Is this a bug? (The standard Sun C compiler sets `lo' to 65535.)

/* short2long.c, pme@umb.umb.edu, 07oct88 */
/* Demonstrate gcc 1.28 bug. */

#include <stdio.h>

void main()
{
    unsigned short sh;
    unsigned long lo;

    sh = ~0;		/* all ones, or, 65535 */
    lo = sh;		/* 0, but why? */

    printf( "sh = %d, lo = %d\n", sh, lo );
    /* Output is 65535, 0 */
}