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]

[PATCH] Fix PR 15720 and some recent C++ regressions


Even after my patch to fix the rs6000 and i386 back-ends for the
recent failures from Zack's changes/addition of mark_decl_referenced,
the darwin back-end has a simple bug in that the SYMBOL_RTX for the
stub does not refer back to the original function decl at all so
the function does not get emitted if it is referenced and it
was decided that we should have a stub early on.  This patch fixes
the bug by making the SYMBOL_RTX refer back to the original function
decl.

OK? Bootstapped on powerpc-apple-darwin with no regressions plus it
fixed some recent C++ testcases.

Thanks,
Andrew Pinski

Testcase (here it is even though I think this is a dup of a testcase
in the testsuite):
struct QMacSavedFontInfo
{
   void init(int*);
    QMacSavedFontInfo() { int w; init(&w); }
};
inline
void QMacSavedFontInfo::init(int*w){}
main () {
  QMacSavedFontInfo foo;
  return (int) &foo;
}

ChangeLog:
	* config/darwin.c (machopic_indirect_call_target): Copy
	the SYMBOL_REF_DECL from the original RTX for the new
	stub RTX.

Patch:
Index: darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.67
diff -u -p -r1.67 darwin.c
--- darwin.c	19 May 2004 02:11:42 -0000	1.67
+++ darwin.c	29 May 2004 02:36:53 -0000
@@ -583,8 +583,10 @@ machopic_indirect_call_target (rtx targe
       if (!machopic_name_defined_p (name))
 	{
 	  const char *stub_name = machopic_stub_name (name);
+	  tree decl = SYMBOL_REF_DECL (XEXP (target, 0));

 	  XEXP (target, 0) = gen_rtx_SYMBOL_REF (mode, stub_name);
+	  SYMBOL_REF_DECL (XEXP (target, 0)) = decl;
 	  RTX_UNCHANGING_P (target) = 1;
 	}
     }


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