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]

PR java/17586 [4.0 regression] kawa build fails with ICE


This is a patch I'm bringing over from the gcj-abi-2-dev-branch.

It fixes a problem when we mention a file on the command line and it
also appears in a path via -I or the classpath.  We were reading the
file twice, once from .java and once from .class, with strange results.

Also, we weren't making sure that read_class really did read the class
we asked for.

Andrew.


	* jcf-parse.c (load_class): Don't try to read a class that we've
	already read.
	Check that we really did read the right class.

Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.169
diff -p -2 -c -r1.169 jcf-parse.c
*** jcf-parse.c	25 Aug 2004 09:52:51 -0000	1.169
--- jcf-parse.c	28 Sep 2004 13:12:18 -0000
*************** load_class (tree class_or_name, int verb
*** 567,571 ****
  {
    tree name, saved;
!   int class_loaded;
  
    /* class_or_name can be the name of the class we want to load */
--- 567,571 ----
  {
    tree name, saved;
!   int class_loaded = 0;
  
    /* class_or_name can be the name of the class we want to load */
*************** load_class (tree class_or_name, int verb
*** 586,594 ****
  
    saved = name;
    while (1)
      {
        char *separator;
  
!       if ((class_loaded = read_class (name)))
  	break;
  
--- 586,603 ----
  
    saved = name;
+ 
    while (1)
      {
        char *separator;
  
!       /* We've already loaded it.  */
!       if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE)
! 	{
! 	  tree tmp_decl = IDENTIFIER_CLASS_VALUE (name);
! 	  if (CLASS_PARSED_P (TREE_TYPE (tmp_decl)))
! 	    break;
! 	}
! 	
!       if (read_class (name))
  	break;
  
*************** load_class (tree class_or_name, int verb
*** 608,611 ****
--- 617,627 ----
      }
  
+   {
+     /* have we found the class we're looking for?  */
+     tree type_decl = IDENTIFIER_CLASS_VALUE (saved);
+     tree type = type_decl ? TREE_TYPE (type_decl) : NULL;
+     class_loaded = type && CLASS_PARSED_P (type);
+   }	      
+ 
    if (!class_loaded && verbose)
      error ("cannot find file for class %s", IDENTIFIER_POINTER (saved));


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