[gnu.gcc.bug] gcc fails to optimize redundant array stores

schmidt@POMPE.ICS.UCI.EDU ("Douglas C. Schmidt") (01/15/89)

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