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]
Other format: [Raw text]

frv flow crash on direct returns


When tree-ssa was merged, frv-elf stopped building.  cmovh.c for
libgcc was what failed to build.  Here's a minimized testcase:

void f(int a, int b, int c) {
  if (a < b || a > b + 1)
    while (c)
      --c;
}

This crashed when flow for sched2 realized LR, that wasn't live
before, had become live because a direct return (that uses LR) was
inserted in postreload.

Richard Sandiford had already written a patch for what I believe to be
an earlier occurrence of this problem, back when he introduced
conditional returns.  Here's the patch.  I'm tempted to install it as
obvious, but...  Ok?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	2003-11-19  Richard Sandiford <rsandifo@redhat.com>
	* config/frv/frv.h (EPILOGUE_USES): New.  Use LR.

Index: gcc/config/frv/frv.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/frv/frv.h,v
retrieving revision 1.47
diff -u -p -r1.47 frv.h
--- gcc/config/frv/frv.h 21 May 2004 01:03:17 -0000 1.47
+++ gcc/config/frv/frv.h 28 May 2004 06:52:49 -0000
@@ -959,6 +959,8 @@ extern int target_flags;
 #define EH_RETURN_STACKADJ_RTX	gen_rtx_REG (SImode, STACKADJ_REGNO)
 #define EH_RETURN_HANDLER_RTX   RETURN_ADDR_RTX (0, frame_pointer_rtx)
 
+#define EPILOGUE_USES(REGNO) ((REGNO) == LR_REGNO)
+
 /* An initializer that says which registers are used for fixed purposes all
    throughout the compiled code and are therefore not available for general
    allocation.  These would include the stack pointer, the frame pointer
-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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