This is the mail archive of the 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]

Re: [ecj] Patch: FYI: fix ordering bugs, others

Tom Tromey writes:
 > >>>>> "Andrew" == Andrew Haley <> writes:
 > >> * PR 27643, a bug involving the order in which we read class files.
 > >> This is fixed by moving around the java_mark_class_local logic.
 > >> Note that this breaks .java compilation; I didn't look into this
 > >> because...
 > Andrew> I'd like to back-port the fix for PR 27643 to older branches.  In what
 > Andrew> way does it break .java compilation?  It looks to mek like the change
 > Andrew> you made only affects .class files.
 > I don't remember, sorry.

I've looked, and I'm sure your patch for PR 27643 is wrong, sorry.  :-(

It disables the use of hidden aliases when compiling from .jar files.
This is because the code path where you moved the call to
java_mark_class_local() isn't executed when compiling from .jar.

A simpler fix for this PR is, rather than trying to move the call to
java_mark_class_local(), to fix up the RTL when we mark the decl.  If
a call has already been made to the external symbol rather than its
hidden alias, that really doesn't matter.


2007-12-17  Andrew Haley  <>

	PR java/27643
	* decl.c (java_mark_cni_decl_local): If the ASSEMBLER_NAME is
	already set, call java_mangle_decl() and make_decl_rtl() to
	rewrite its name as a hidden alias.
Index: java/decl.c
--- java/decl.c (revision 123182)
+++ java/decl.c (working copy)
@@ -2180,18 +2180,27 @@
 static void
 java_mark_cni_decl_local (tree decl)
-  /* Setting DECL_LOCAL_CNI_METHOD_P changes the behavior of the mangler.
-     We expect that we should not yet have referenced this decl in a 
-     context that requires it.  Check this invariant even if we don't have
-     support for hidden aliases.  */
-  gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));
 #if !defined(HAVE_GAS_HIDDEN) || !defined(ASM_OUTPUT_DEF)
   DECL_LOCAL_CNI_METHOD_P (decl) = 1;
+  /* Setting DECL_LOCAL_CNI_METHOD_P changes the behavior of the
+     mangler.  We might have already referenced this native method and
+     therefore created its name, but even if we have it won't hurt.
+     We'll just go via its externally visible name, rather than its
+     hidden alias.  However, we must force things so that the correct
+     mangling is done.  */
+    java_mangle_decl (decl);
+  if (DECL_RTL_SET_P (decl))
+    {
+      SET_DECL_RTL (decl, 0);
+      make_decl_rtl (decl);
+    }
 /* Use the preceding two functions and mark all members of the class.  */

Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903

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