This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

FYI: typo in gcse.c since Jan 28


RTH's patch from Jan 28 broke gcse.c:compute_can_copy() such that it
wouldn't compile if AVOID_CCMODE_COPIES was defined, and would
miscompile otherwise.  I'm checking this in under the obviously
correct rule.  If it doesn't appear obvious to you that this is the
right fix, the original code, before Jan 28's patch, will certainly
make it clear :-)

Here's the hunk in the patch that broke it:

*** 837,860 ****
  
    start_sequence ();
    for (i = 0; i < NUM_MACHINE_MODES; i++)
!     {
!       switch (GET_MODE_CLASS (i))
! 	{
! 	case MODE_CC :
  #ifdef AVOID_CCMODE_COPIES
! 	  can_copy_p[i] = 0;
  #else
! 	  reg = gen_rtx_REG ((enum machine_mode) i, LAST_VIRTUAL_REGISTER + 1);
! 	  insn = emit_insn (gen_rtx_SET (VOIDmode, reg, reg));
! 	  if (recog (PATTERN (insn), insn, NULL_PTR) >= 0)
! 	    can_copy_p[i] = 1;
  #endif
! 	  break;
! 	default :
  	  can_copy_p[i] = 1;
! 	  break;
! 	}
!     }
    end_sequence ();
  
    /* Free the objects we just allocated.  */
--- 827,846 ----
  
    start_sequence ();
    for (i = 0; i < NUM_MACHINE_MODES; i++)
!     if (GET_MODE_CLASS (i) == MODE_CC)
!       {
  #ifdef AVOID_CCMODE_COPIES
! 	can_copy_p[i] = 0;
  #else
! 	reg = gen_rtx_REG ((enum machine_mode) i, LAST_VIRTUAL_REGISTER + 1);
! 	insn = emit_insn (gen_rtx_SET (VOIDmode, reg, reg));
! 	if (recog (PATTERN (insn), insn, NULL_PTR) >= 0)
! 	  can_copy_p[i] = 1;
  #endif
! 	else
  	  can_copy_p[i] = 1;
!       }
! 
    end_sequence ();
  
    /* Free the objects we just allocated.  */

and here's the fix I'm installing:

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* gcse.c (compute_can_copy): Adjust if/else blocks from rth's
	patch from 2000-01-28.
	
Index: gcc/gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.81
diff -u -r1.81 gcse.c
--- gcc/gcse.c	2000/03/03 08:28:43	1.81
+++ gcc/gcse.c	2000/03/07 02:49:56
@@ -837,9 +837,9 @@
 	if (recog (PATTERN (insn), insn, NULL_PTR) >= 0)
 	  can_copy_p[i] = 1;
 #endif
-	else
-	  can_copy_p[i] = 1;
       }
+    else
+      can_copy_p[i] = 1;
 
   end_sequence ();
 

-- 
Alexandre Oliva     http://www.ic.unicamp.br/~oliva/     Enjoy Guaranį
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]