🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2523

optimizer bug

#2523
From: Eirik Fuller
Date: Tue, 11 Apr 1989 00:00
37 lines
1053 bytes
gcc 1.34 compiles the enclosed program incorrectly on a Tek 4316, when
invoked with -O.  Since the gcc configuration for the 4316 is similar
to the Sun 3 (68020/68881, m68k.md, tm-m68k.h), the same problem might
also occur on a Sun 3.

bug.c:

main()
{
  struct { char c; unsigned int i: 11; } s;
  s.i = 0;
  exit ( s.i ? 1 : 0 );
}

bug.s:

#NO_APP
gcc_compiled.:
.text
	.even
.globl _main
_main:
	link a6,#0
	bfclr d0{#8:#11}
	jeq L2
	moveq #1,d0
	jra L3
L2:
	clrl d0
L3:
	movel d0,sp@-
	jbsr _exit
	unlk a6
	rts

If d0 is nonzero after the bfclr, the conditional branch to L2 isn't
taken, and the program incorrectly exits with status 1.
Technical Details
Message-ID: <8904110000.AA07361@elf.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ELF.STANFORD.EDU!eirik

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ELF.STANFORD.EDU!eirik
From: eirik@ELF.STANFORD.EDU (Eirik Fuller)
Newsgroups: gnu.gcc.bug
Subject: optimizer bug
Message-ID: <8904110000.AA07361@elf.Stanford.EDU>
Date: 11 Apr 89 00:00:43 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 37