🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2154

gcc fails to optimize redundant array stores

#2154
From: "Douglas C. Schmidt"
Date: Sun, 15 Jan 1989 01:00
60 lines
1428 bytes
Bug Report for GCC:
-------------------
Problem : gcc 1.32 doesn't seem to recognize and omit
	       redundant stores into an array.  The Sun 3 CC
          compiler performs this optimization with -O3 and/or
          -O4.

1.) Version : gcc 1.32
-----------

2.) Input Program :
-----------------

main ( ) {
   static int foo[10] = { 1,2,3,4,5,6,7 };

   foo[2] = 10; 
   foo[2] = 10; /* redundant computation */
}

3.) Command Used : gcc -O
----------------

4.) Files used :
--------------
   Sun 3 files for the m68k.
      
5.) Machine(s) used :
-------------------
   Sun 3 running Sun4.0

6.) Asm output :
------------------------

#NO_APP
gcc_compiled.:
.data
	.even
_foo.0:
	.long 1
	.long 2
	.long 3
	.long 4
	.long 5
	.long 6
	.long 7
	.skip 12
.text
	.even
.globl _main
_main:
	link a6,#0
	lea _foo.0+8,a0
	moveq #10,d0
	movel d0,a0@ 
	moveq #10,d0         # this seems 
	movel d0,a0@         # redundant
	unlk a6
	rts
Technical Details
Message-ID: <8901141716.aa00839@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!texbell!nuchat!uunet!tut.cis.ohio-state.edu!POMPE.ICS.UCI.EDU!schmidt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!texbell!nuchat!uunet!tut.cis.ohio-state.edu!POMPE.ICS.UCI.EDU!schmidt
From: schmidt@POMPE.ICS.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.gcc.bug
Subject: gcc fails to optimize redundant array stores
Message-ID: <8901141716.aa00839@PARIS.ICS.UCI.EDU>
Date: 15 Jan 89 01:00:51 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 60