🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1720

GCC-1.28 generates incorrect code for the AT&T UnixPC

#1720
From: rphroy!tetnix!tet
Date: Sun, 02 Oct 1988 06:18
96 lines
2582 bytes
PROBLEM: Gcc-1.28, (when not optimizing), produces
	incorrect code for moves from an unsigned short
	to either an int or an unsigned int.
	With the optimizer on, the correct code is emitted.

	Tom Tkacik
	{umix!mcf, uunet!edsews}!rphroy!tetnix!tet

SYSTEM: AT&T UnixPC   UNIX: SYSV.?  (ver 3.5)

CONFIGURATION FILES: standard for the UnixPC
	tm.h         ----> tm-3b1.h
	md   	     ----> m68k.md
	aux-output.c ----> output-m68k.c

COMMAND: gcc -v -S -gg bug.c
	The -gg option is for aiding in reading the output file.
	A program compiled with -gg cannot be assembled on the UnixPC.

VERSION:
gcc version 1.28
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68k -Dunix -Dunixpc bug.c /tmp/cca03586.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cca03586.cpp -quiet -dumpbase bug.c -version -symout /tmp/cca03586.sym -o bug.s
GNU C version 1.28 (68k, SGS/AT&T unixpc syntax) compiled by GNU C version 1.28.

---------------------------------------------------------------
/* bug.c -- gcc makes two errors in this code */

unsigned int ui;
         int i;
unsigned short us;
         short s;

f()
{
	i = s;
	i = us;		/* gcc gets this wrong */
	ui = s;
	ui = us;	/* this also */
}
---------------------------------------------------------------

	file	"bug.c"
.text 0
.gdbbeg 0
.gdbbeg 1
Ltext:	.stabs "bug.c",100,0,0,Ltext
.data 0
Ldata:
	lcomm Lbss,0
.gdbsym Ldata,52
.gdbsym Lbss,56
text
	even
	global f
f:
	.gdbbeg 2
	.gdbline 0,9
	link.w %a6,&0
	mov.l %d2,-(%sp)
	.gdbline 0,10
	mov.w s,%a0	<---- short to int is correct
	mov.l %a0,i
	.gdbline 0,11
	mov.w us,%d2	<---- unsigned short to int is wrong
	clr.l i
	mov.l i,%d0
	mov.w %d2,%d0
	mov.l %d0,%d0
	.gdbline 0,12
	mov.w s,%a0	<---- short to unsigned is correct
	mov.l %a0,ui
	.gdbline 0,13
	mov.w us,%d2	<---- unsigned short to unsigned is wrong
	clr.l ui
	mov.l ui,%d0
	mov.w %d2,%d0
	mov.l %d0,%d0
	.gdbline 0,14
L%1:
	.gdbend 2
	mov.l -4(%a6),%d2
	unlk %a6
	rts
	.gdbblock 2,1188
	comm s,2
	comm us,2
	comm i,4
	comm ui,4
.text 0
	.gdbend 0
	.gdbblock 0,1328
	.gdbend 1
	.gdbblock 1,1864
	.gdblinetab 0,2092
Technical Details
Message-ID: <8810020618.AA01279@rphroy.gmrl.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!rphroy!tetnix!tet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!rphroy!tetnix!tet
From: rphroy!tetnix!tet@UUNET.UU.NET
Newsgroups: gnu.gcc.bug
Subject: GCC-1.28 generates incorrect code for the AT&T UnixPC
Message-ID: <8810020618.AA01279@rphroy.gmrl.com>
Date: 2 Oct 88 06:18:09 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 96