🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2143

bug in 132 optimizer

#2143
From: Joseph R. Pickert
Date: Tue, 10 Jan 1989 20:08
63 lines
2043 bytes
BUG IN GCC 1.32 Optimizer.

The following subroutine produces bad code (see keywords RIGHT and WRONG
below) with the gcc 1.32 optimizer turned on.

build_sig(x, sig)
char *x;
int sig;
{
  register struct frame {
	short	f_sig;
  } *fp;
  fp = (struct frame *) x;
  fp->f_sig = sig;
}

NOT OPTIMIZED:
================================================================================

gcc version 1.32
 /usr/src/local/gnuC++/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 c.c /tmp/cca28852.cpp
GNU CPP version 1.32
 /usr/src/local/gnuC++/lib/gcc-cc1 /tmp/cca28852.cpp -quiet -dumpbase c.c -version -o c.s
GNU C version 1.32 (68k, MIT syntax) compiled by GNU C version 1.32.

yields:

#NO_APP
gcc_compiled.:
.text
	.even
.globl _build_sig
_build_sig:
	link a6,#0
	movel a6@(8),a0
	movew a6@(14),a0@		<============ RIGHT
L1:
	unlk a6
	rts


OPTIMIZED:
================================================================================

gcc version 1.32
 /usr/src/local/gnuC++/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 c.c /tmp/cca28866.cpp
GNU CPP version 1.32
 /usr/src/local/gnuC++/lib/gcc-cc1 /tmp/cca28866.cpp -quiet -dumpbase c.c -O -version -o c.s
GNU C version 1.32 (68k, MIT syntax) compiled by GNU C version 1.32.

yields:

#NO_APP
gcc_compiled.:
.text
	.even
.globl _build_sig
_build_sig:
	link a6,#0
	movel a6@(8),a0
	movew a6@(12),a0@		<============ WRONG, sb a6@(14)
	unlk a6
	rts
Technical Details
Message-ID: <8901102008.AA28018@uicsrd.csrd.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!bionet!rutgers!tut.cis.ohio-state.edu!UICSRD.CSRD.UIUC.EDU!pickert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!bionet!rutgers!tut.cis.ohio-state.edu!UICSRD.CSRD.UIUC.EDU!pickert
From: pickert@UICSRD.CSRD.UIUC.EDU (Joseph R. Pickert)
Newsgroups: gnu.gcc.bug
Subject: bug in 132 optimizer
Message-ID: <8901102008.AA28018@uicsrd.csrd.uiuc.edu>
Date: 10 Jan 89 20:08:45 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 63