Bug 17845 - [4.1 Regression] More problems with simple type names as superclasses
Summary: [4.1 Regression] More problems with simple type names as superclasses
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Paolo Bonzini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-05 15:42 UTC by Tom Tromey
Modified: 2005-08-17 15:16 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-05 20:02:02


Attachments
patch to fix the bug (1.21 KB, patch)
2005-05-19 07:41 UTC, Paolo Bonzini
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2004-10-05 15:42:52 UTC
I can't build GNU Classpath with current cvs gcj.
This may be a regression, though it is also possible
that Classpath changed in a way that gcj can't handle.

The code in question is correct.  It appears that gcj
is picking the wrong 'Certificate':

make[1]: Entering directory `/home/tromey/gnu/classpath/build/lib'
top_builddir=.. /bin/sh ./gen-classlist.sh standard
/home/tromey/gnu/Binarycompat/install/bin/gcj --bootclasspath '' --classpath
../../classpath:../vm/current:.: -C -d . @classes
../../classpath/java/security/cert/X509Certificate.java:143: error: Class
`java.security.cert.X509Certificate' can't subclass interface
`java.security.Certificate'.
   public abstract class X509Certificate extends Certificate implements
X509Extension
                                                 ^
../../classpath/java/security/cert/X509Certificate.java:0: confused by earlier
errors, bailing out
Comment 1 Andrew Pinski 2004-10-05 20:02:02 UTC
Confirmed.
Comment 2 Andrew Haley 2004-10-06 09:23:28 UTC
You haven't provided full instructions to duplicate this.

Can you please submit

1.  The commands you used to check out the source.
2.  The commands you used to configure and build.

Yes, I know that I could figure it out, but as you must already know this
information why not provide it in the PR?
Comment 3 Andrew Haley 2004-10-06 12:05:11 UTC
I built with
 $ gcj --version
gcj (GCC) 4.0.0 20041006 (experimental)
 $ `pwd`/../configure --with-gcj --disable-gtk-peer

 $ make
Making all in lib
make[1]: Entering directory `/home/aph/classpath/build/lib'
top_builddir=.. /bin/sh ./gen-classlist.sh standard
/home/aph/gcc/install/bin/gcj --bootclasspath '' --classpath
/home/aph/classpath/build/..:../vm/current:.: -C -d . @classes
touch compile-classes
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
touch resources
if test "/usr/bin/zip" != ""; then /usr/bin/zip -r -D glibj.zip gnu java javax o

...

make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/home/aph/classpath/build'
$ uname -a
Linux zorro.pink 2.4.21-4.17.EL #1 Mon Nov 17 19:46:22 EST 2003 x86_64 x86_64
x86_64 GNU/Linux
Comment 4 Tom Tromey 2004-10-06 18:57:05 UTC
Here's how I configured.
Some of these options aren't used by classpath, they come from my
generic build script.
Note that this reliably fails for me on x86 fc2.
It failed again last night.

opsy. ./config.status --version
GNU Classpath config.status 0.11+cvs
configured by ../classpath/configure, generated by GNU Autoconf 2.59,
  with options "'--prefix=/home/tromey/gnu/classpath/install'
'--enable-languages=c++,java' '--enable-threads=posix' '--enable-checking=tree'
'--enable-java-awt=gtk,xlib' '--with-gcj' '--enable-jni' '--enable-regen-headers'"
                                                                                
Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
Comment 5 Andreas Tobler 2004-10-06 20:31:20 UTC
these are my classpath config options:

[wolfram:~/home-work/cp-objdir] andreast% ./config.status --version
GNU Classpath config.status 0.11+cvs
configured by ../classpath/configure, generated by GNU Autoconf 2.59,
  with options "'--with-gcj'"

[wolfram:~/home-work/cp-objdir] andreast% gcj -v
Reading specs from
/Volumes/src/gcc/gcc-cvs/testbin/lib/gcc/powerpc-apple-darwin7.5.0/4.0.0/specs

Configured with: /Volumes/src/gcc/gcc-cvs/gcc/configure
--prefix=/Volumes/src/gcc/gcc-cvs/testbin --disable-checking
--enable-languages=c,c++,java --enable-java-awt=gtk --enable-gtk-cairo
--enable-libgcj-multifile
Thread model: posix
gcc version 4.0.0 20041006 (experimental)

The failure is the same as Tom's.

I tried before aph's ci (where the first change has a wrong date btw.) yesterday
morning and today after all ci's on gcc/java. So, form my side it is not coming
form aph's patch.

[wolfram:gcc-cvs/objdir/gcc] andreast% cat ../../gcc/LAST_UPDATED 
Wed Oct  6 10:15:09 CEST 2004
Wed Oct  6 08:15:09 UTC 2004


The machine is a G4 with 1GB of mem.

The CL entries I refer to.

2004-10-05  Andrew Haley  <aph@redhat.com>

        PR java/17779
        * jcf-parse.c (parse_zip_file_entries): If a class has a
        superclass and a TYPE_SIZE of zero, lay it out.

2004-09-30  Andrew Haley  <aph@redhat.com>
        
        PR java/17733
        * jcf-parse.c (compute_class_name): Rewrite.
Comment 6 Andrew Haley 2004-10-07 10:25:09 UTC
Tom, can you build on a machine I can reach?  Toronto, maybe?
Comment 7 Tom Tromey 2004-10-11 01:32:07 UTC
I did a build in Toronto.  It works perfectly there.
However, it continues to fail here at home nightly.
These nightly builds are pristine; I don't know what is
going on.
Comment 8 Andrew Haley 2004-10-11 09:11:20 UTC
Subject:  can't build GNU Classpath

I think I'm going to have to give up on this bug.  If I can't
duplicate the problem myself and you can't duplicate the propblem on
any machine to which I have access there's nothing that I can do.
Comment 9 Andrew Haley 2004-10-18 16:13:10 UTC
I can't duplicate this problem, nor can anyone else duplicate it on any machine
to which I have access.
Comment 10 Mark Wielaard 2004-10-27 19:07:56 UTC
Got another report for this on powerpc-apple-darwin7.5.0, gcj 3.4.2.
I have added a workaround for it in GNU Classpath CVS

--- java/security/cert/X509Certificate.java     20 Oct 2004 07:11:40 -0000     1.7
+++ java/security/cert/X509Certificate.java     27 Oct 2004 19:03:07 -0000
@@ -135,7 +135,9 @@
  * @author Mark Benvenuto
  * @author Casey Marshall (rsdio@metastatic.org)
  */
-public abstract class X509Certificate extends Certificate implements X509Extension
+public abstract class X509Certificate
+  extends java.security.cert.Certificate  // XXX workaround for gcj bug #17845
+  implements X509Extension
 {
   private static final long serialVersionUID = -2491127588187038216L;
Comment 11 Andrew Haley 2004-10-27 19:14:21 UTC
Does this mean that you've actually been able to duplicate the bug?

Can you at least let me have a backtrace?

Surely it's better to fix the bug than install a workaround in Classpath.
Comment 12 Mark Wielaard 2004-10-27 20:06:11 UTC
> Does this mean that you've actually been able to duplicate the bug?
> Can you at least let me have a backtrace?
> Surely it's better to fix the bug than install a workaround in Classpath.

I have seen the bug occur on a cygwin machine to which I don't have access
anymore. I thought it was related to the file system being case-insensitive so
jikes was used to do the source to byte code compilation.

Chris is now seeing it on his powerpc machine.
The workaround at least makes it possible to keep working on GNU Classpath. We
have a policy that GNU Classpath (releases) need to be able to be build with the
latest GCC release (and possibly older versions or CVS).

There isn't a backtrace since it just gives this error messages:

../../classpath/java/security/cert/X509Certificate.java:143: error: Class
`java.security.cert.X509Certificate' can't subclass interface
`java.security.Certificate'.
   public abstract class X509Certificate extends Certificate implements
X509Extension
                                                 ^
../../classpath/java/security/cert/X509Certificate.java:0: confused by earlier
errors, bailing out

Is there a trick to get you the backtrace you need to further analyze why this
is happening?
Comment 13 Andrew Pinski 2005-05-01 14:05:26 UTC
Is this true anymore, I built classpath a couple of days ago on powerpc-darwin with a case-insensitive 
file system and it worked for me.
Comment 14 dog@bluezoo.org 2005-05-01 17:24:41 UTC
Subject: Re:  can't build GNU Classpath

pinskia at gcc dot gnu dot org wrote:
> Is this true anymore, I built classpath a couple of days ago on 
> powerpc-darwin with a case-insensitive
> file system and it worked for me.

works for me.
Comment 15 Andrew Pinski 2005-05-01 17:28:48 UTC
Fixed or at least works for me.
Comment 16 Paolo Bonzini 2005-05-11 11:04:48 UTC
It can be reproduced in libgcj, with --enable-libgcj-multifile.

Paolo
Comment 17 Paolo Bonzini 2005-05-11 11:06:05 UTC
I'll try to produce a reduced test case.
Comment 18 Paolo Bonzini 2005-05-11 12:18:56 UTC
Reduced test case:

==> Dummy.java <==
package java.security;
class Dummy
{
}

==> gnuX509Certificate.java <==
package gnu.java.security.x509;
class X509Certificate extends java.security.cert.X509Certificate
{
}

==> X509Certificate.java <==
package java.security.cert;
public abstract class X509Certificate extends Certificate
{
}


jc1 Command line:

../../gcc/jc1 srclist -fclasspath= -fbootclasspath=.:../../../libjava
-ffilelist-file -fsyntax-only
Comment 19 Andrew Pinski 2005-05-11 12:25:37 UTC
(In reply to comment #18)
> Reduced test case:
I saw something like this before in a different bug.
Comment 20 paolo.bonzini@lu.unisi.ch 2005-05-11 12:31:28 UTC
Subject: Re:  [4.1 Regression] More problems with simple type
 names as superclasses


>I saw something like this before in a different bug.
>
It must have been PR21436, which I also reported/distilled/fixed.

But it is not a dup, because no imports are involved in this case.

Paolo
Comment 21 Paolo Bonzini 2005-05-12 08:09:17 UTC
This code in do_resolve_class seems bogus to me.  Fixing it removes the failure.
 Note that java.security is in the package_list because of Dummy.java, but it
absolutely does *not* belong in the search path!

This is the only use of package_list, by the way.

   /* 5- Try with a name qualified with the package names we've seen so far */
   if (!QUALIFIED_P (TYPE_NAME (class_type)))
     {
       tree package;
 
       /* If there is a current package (ctxp->package), it's the first
         element of package_list and we can skip it. */
       for (package = (ctxp->package ?
                      TREE_CHAIN (package_list) : package_list);
           package; package = TREE_CHAIN (package))
        if ((new_class_decl = qualify_and_find (class_type,
                                               TREE_PURPOSE (package),
                                               TYPE_NAME (class_type))))
          return new_class_decl;
     }
Comment 22 Paolo Bonzini 2005-05-12 14:10:24 UTC
Not fixing the hunk -- removing it actually!
Comment 23 Paolo Bonzini 2005-05-19 07:41:06 UTC
Created attachment 8926 [details]
patch to fix the bug
Comment 24 Paolo Bonzini 2005-05-19 11:16:37 UTC
Fixed by patch.
Comment 25 GCC Commits 2005-05-19 11:20:01 UTC
Subject: Bug 17845

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2005-05-19 11:16:31

Modified files:
	gcc/java       : parse.y ChangeLog 

Log message:
	2005-05-19  Paolo Bonzini  <bonzini@gnu.org>
	
	PR java/17845
	
	* parse.y (register_package, package_list): Remove.
	(package_declaration): Do not call register_package.
	(do_resolve_class): Do not use package_list.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.533&r2=1.534
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1612&r2=1.1613

Comment 26 GCC Commits 2005-08-17 12:57:31 UTC
Subject: Bug 17845

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	bonzini@gcc.gnu.org	2005-08-17 12:57:08

Modified files:
	libjava        : ChangeLog Makefile.am Makefile.in configure 
	                 configure.ac 
	libjava/external: Makefile.in 
	libjava/external/sax: Makefile.in 
	libjava/external/w3c_dom: Makefile.in 
	libjava/gcj    : Makefile.in 
	libjava/include: Makefile.in 
	libjava/testsuite: Makefile.in 
	libjava/testsuite/libjava.jacks: jacks.xfail 
	gcc/java       : ChangeLog class.c parse.h parse.y 

Log message:
	libjava:
	2005-08-17  Paolo Bonzini  <bonzini@gnu.org>
	
	Backport from mainline:
	
	2005-05-18  Paolo Bonzini  <bonzini@gnu.org>
	
	* Makefile.am (Makefile.deps): Do not use \0, it is unportable.
	* Makefile.in: Regenerate.
	
	2005-05-17  Paolo Bonzini  <bonzini@gnu.org>
	
	* configure.ac (--enable-libgcj-multifile): Remove.
	
	* Makefile.am (all_native_compiled_source_files,
	(all_native_compiled_dirs, all_java_dirs, all_java_lo_files,
	all_libgcj_lo_files, all_xlib_lo_files,
	all_java_deps_files, all_java_stamp_files,
	all_java_filelist_files): New variables.
	(EXTRA_DIST): New Automake variable.
	(CLEANFILES): Add .stamp, .list and .lo files.
	(%.list, %.lo, %.stamp, Makefile.deps): New rules.
	(classes.stamp): Depend on $(all_java_stamp_files).
	(libgcj.la): Pass $(libgcj_la_LIBADD) to the linker without
	going through write_entries_to_file.
	
	(all_java_source_files, all_property_files): Move earlier.
	(libgcj_la_OBJECTS, javao_files, xlib_javao_files,
	all_java_class_files): Remove.
	(gtk_awt_peer_sources): Rename to...
	(gtk_awt_peer_source_files): ... this.  Adjust throughout.
	
	(ONESTEP): Remove.
	(libgcj0_convenience_la_SOURCES): Remove Java source files.
	(libgcj0_convenience_la_LIBADD): Add $(all_libgcj_lo_files).
	(libgcj0_convenience_la_DEPENDENCIES): Likewise.
	(libgcj_la_SOURCES): Remove.
	(lib_gnu_awt_xlib_la_SOURCES): Remove Java source files.
	(lib_gnu_awt_xlib_la_LIBADD): Add $(all_xlib_lo_files).
	(lib_gnu_awt_xlib_la_DEPENDENCIES): Likewise.
	
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* external/Makefile.in: Regenerate.
	* external/sax/Makefile.in: Regenerate.
	* external/w3c_dom/Makefile.in: Regenerate.
	* gcj/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libltdl/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	
	2005-05-10  Paolo Bonzini  <bonzini@gnu.org>
	
	PR java/21436
	* testsuite/libjava.jacks/jacks.xfail: Adjust.
	
	gcc/java:
	2005-08-17  Paolo Bonzini  <bonzini@gnu.org>
	
	Backport from mainline:
	
	2005-05-19  Paolo Bonzini  <bonzini@gnu.org>
	
	PR java/17845
	
	* parse.y (register_package, package_list): Remove.
	(package_declaration): Do not call register_package.
	(do_resolve_class): Do not use package_list.
	
	2005-05-10  Paolo Bonzini  <bonzini@gnu.org>
	
	PR java/21436
	* class.c (maybe_layout_super_class): Look for imports in this_class.
	* parse.h (ctxp_for_generation_last): New.
	(do_resolve_class): Add a parameter.
	* parse.y (ctxp_for_generation_last): New.
	(java_pop_parser_context): Add at end of list.
	(find_in_imports, find_in_imports_on_demand): Look in ctxp
	if the TYPE_IMPORT_LIST or respectively the TYPE_IMPORT_DEMAND_LIST of
	the given type are NULL.
	(do_resolve_class): Look into the imports of the new second parameter.
	Adjust recursive calls.
	(resolve_class, resolve_inner_class, find_as_inner_class): Adjust
	calls to do_resolve_class.
	(create_class): Set the TYPE_IMPORT_LIST and TYPE_IMPORT_DEMAND_LIST.
	(java_complete_class): Do not do that here.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3391.2.89&r2=1.3391.2.90
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.am.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.455.2.13&r2=1.455.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.485.2.13&r2=1.485.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.253.2.4&r2=1.253.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.ac.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.19.2.4&r2=1.19.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.14.2&r2=1.1.14.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/sax/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2.12.2&r2=1.2.12.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/external/w3c_dom/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2.12.2&r2=1.2.12.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gcj/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.62.10.2&r2=1.62.10.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.64.4.2&r2=1.64.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.73.10.2&r2=1.73.10.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jacks/jacks.xfail.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.19&r2=1.19.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1556.2.27&r2=1.1556.2.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/class.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.220.8.3&r2=1.220.8.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.103&r2=1.103.18.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.528.6.2&r2=1.528.6.3