🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1138

shift count warning

#1138
From: Michael Shapiro
Date: Mon, 14 Sep 1992 16:52
22 lines
929 bytes
The following short program gives a warning message I think it shouldn't.
I wanted to pass this by you to see why it is giving me the warning. The
compiled code does what it is supposed to do:

    main()
    {
	unsigned char b;
	int x,y;

	x = 511;
	y = 1;

	b = (unsigned char )(x - (y<<8));
	printf ("%d\n", (int)b);
    }

# gcc main.c
main.c: In function `main':
main.c:9: warning: shift count exceeds width of value shifted

# a.out
255
Technical Details
Message-ID: <199209141652.AA24234@zorro.cecer.army.mil>
Path: arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zorro.cecer.army.mil!shapiro

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zorro.cecer.army.mil!shapiro
From: shapiro@zorro.cecer.army.mil (Michael Shapiro)
Newsgroups: gnu.gcc.bug
Subject: shift count warning
Message-ID: <199209141652.AA24234@zorro.cecer.army.mil>
Date: 14 Sep 92 16:52:22 GMT
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 22
Approved: bug-gcc@prep.ai.mit.edu