This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] PR java/21418: Order of files on command line matters whileresolving inheritance
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: mark at klomp dot org
- Date: Wed, 21 Sep 2005 15:23:32 +0530
- Subject: [Patch] PR java/21418: Order of files on command line matters whileresolving inheritance
- Openpgp: url=http://ranjitmathew.hostingzero.com/aa_6C114B8F.txt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
The attached patch seems to resolve the problem reported
in PR java/21418. Mark, would you be able to test this
patch and see if this resolves your problem building
GNU Classpath after you remove the "sort -r" kludge?
The problem was that depending on the order in which the
files are compiled, the super class might not have been
laid out (CLASSTYPE_SUPER returns a POINTER_TYPE instead
of a RECORD_TYPE - not sure if *that* in itself is a bug
or not).
The patch was tested on i686-pc-linux-gnu and produces
no changes in the libjava testsuite (Jacks included).
OK for mainline?
Thanks,
Ranjit.
:ADDPATCH java:
- --
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.hostingzero.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDMS2cYb1hx2wRS48RAgd+AJ9ShIwl/Gh1TrImGqyX1Ujra/ti9wCcCyuV
Wwms76oifcGawCHATolG5pQ=
=38IY
-----END PGP SIGNATURE-----
Index: ChangeLog
from Ranjit Mathew <rmathew@gcc.gnu.org>
PR java/21418
* class.c (inherits_from_p): Try to lay out super class
if it is not already laid out.
Index: class.c
===================================================================
--- class.c 2005-09-21 12:36:32.000000000 +0530
+++ class.c 2005-09-21 12:58:52.000000000 +0530
@@ -546,11 +546,22 @@ int
inherits_from_p (tree type1, tree type2)
{
+ tree super_class;
+
while (type1 != NULL_TREE && TREE_CODE (type1) == RECORD_TYPE)
{
if (type1 == type2)
return 1;
+
if (! CLASS_LOADED_P (type1))
load_class (type1, 1);
- type1 = CLASSTYPE_SUPER (type1);
+
+ super_class = CLASSTYPE_SUPER (type1);
+
+ if (super_class && TREE_CODE (super_class) == POINTER_TYPE)
+ {
+ super_class = maybe_layout_super_class (super_class, type1);
+ }
+
+ type1 = super_class;
}
return 0;