This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Fix for java name mangling bug
- To: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: Fix for java name mangling bug
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Date: Tue, 30 Oct 2001 02:17:31 +1300
This patch fixes PR 4717. We were mis-mangling type references in
symbols like the following because the mangler would accidentally match
compression references when it shouldn't.
eg:
package z.b.c;
import a.b.*;
public class Bar
{
native int bad2 (a.b.Foo f);
}
Incorrect symbol:
_ZN1z1b1c3Bar4bad2EPNS0_3FooE
z.b.c.Bar.bad2(z.b.Foo)
Correct symbol:
_ZN1z1b1c3Bar4bad2EPN1a1b3FooE
z.b.c.Bar.bad2(a.b.Foo)
Bootstrapped libgcj. OK to commit?
Bryce.
2001-10-29 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* mangle.c (find_compression_record_match): Don't match compression
records for package name elements unless they occur at the start of
the name. Fix for PR java/4717.
Index: mangle.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/mangle.c,v
retrieving revision 1.17
diff -u -r1.17 mangle.c
--- mangle.c 2001/10/25 21:37:44 1.17
+++ mangle.c 2001/10/29 12:53:52
@@ -327,7 +327,19 @@
{
match = i = j;
saved_current = current;
+ i++;
break;
+ }
+ else
+ {
+ /* We don't want to match an element that appears in the middle
+ of a package name, so skip forward to the next complete type name.
+ IDENTIFIER_NODEs are partial package names while RECORD_TYPEs
+ represent complete type names. */
+ while (j < compression_next
+ && TREE_CODE (TREE_VEC_ELT (compression_table, j)) ==
+ IDENTIFIER_NODE)
+ j++;
}
}