java/1434: jc1 dies on implicit String conversion

kuipers@cwi.nl kuipers@cwi.nl
Wed Dec 20 12:26:00 GMT 2000


>Number:         1434
>Category:       java
>Synopsis:       jc1 dies on implicit String conversion
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:50 PST 2000
>Closed-Date:    Mon Nov 29 09:45:01 PST 1999
>Last-Modified:  Mon Nov 29 09:50:00 PST 1999
>Originator:     Tobias Kuipers
>Release:        gcc-2.95.1
>Organization:
>Environment:
This fails on both sparc-sun-solaris2.6 and mips-sgi-irix6.5
>Description:
jc1 dies on statements that contain inline implicit String
conversion, such as on page 356 of the Java Language Spec.
Apparently someone over here actually used this construct. 
He is now being punished :-)
>How-To-Repeat:
Try compiling with
gcj -c Bug.java -o Bug.o

--start file--
public class Bug {

    // This demonstrates a bug in gcj

    public static void main(String[] argv){
	int i = 666;
	System.out.println("The number "+i+" is "+ (""+i).length() +" digits wide");
    }
}
--end file--
>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR gcj/55


From: Tom Tromey <tromey@cygnus.com>
To: kuipers@cwi.nl
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/55: jc1 dies on implicit String conversion
Date: Wed, 29 Sep 1999 16:09:58 -0700

 The current gcj doesn't crash when given this code.  However, the
 resulting executable doesn't work correctly, either.  It prints
 nothing when run.
 
 I'm checking the test program in to the libgcj test suite.
 It is called "PR55.java".
 
 Tom

From: Tom Tromey <tromey@cygnus.com>
To: Tobias Kuipers <Tobias.Kuipers@cwi.nl>
Cc: Tom Tromey <tromey@cygnus.com>,
        Java Gnats Server <java-gnats@sourceware.cygnus.com>
Subject: Re: gcj/55: jc1 dies on implicit String conversion 
Date: Mon, 4 Oct 1999 09:53:58 -0700

 >>>>> "Tobias" == Tobias Kuipers <Tobias.Kuipers@cwi.nl> writes:
 
 Tobias> Hm, I've just downloaded and compiled the latest snapshot
 Tobias> release (27 sept 99). Is that the current version you refer
 Tobias> to? Because somehow the version of gcj in there failed even to
 Tobias> compile libgcj...
 
 Tobias> Am I missing something here? What is the current version you
 Tobias> refer to?
 
 I was using a very recent gcc from the cvs repository.  I don't try
 the snapshots.  What version does your snapshot report?  How does it
 fail to compile libgcj?
 
 The snapshots are occasionally buggy.  I wouldn't be too surprised by
 this...
 
 Tom
 

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/55: jc1 dies on implicit String conversion
Date: Thu, 4 Nov 1999 16:30:13 -0800 (PST)

 Tom Tromey writes:
 >  The current gcj doesn't crash when given this code.  
 
 This was the case for Linux, but gcj was crashing under Solaris.
 
 >  However, the resulting executable doesn't work correctly, either.
 >  It prints nothing when run.
 
 Yes, gcj simply derailed an ignored the operation.  Can someone try
 this patch? I verified it works under Linux/x86. I'd like to hear
 about Solaris/Sparc (I wasn't able to build the runtime on Solaris
 last time I tried today)
 
 ./A
 
 Thu Nov  4 16:27:01 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
 	* parse.y (resolve_qualified_expression_name): Handle PLUS_EXPR.
 	(qualify_ambiguous_name): Likewise.
 	
 Index: parse.y
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
 retrieving revision 1.117
 diff -u -p -r1.117 parse.y
 --- parse.y	1999/11/02 07:51:19	1.117
 +++ parse.y	1999/11/04 22:34:53
 @@ -6714,6 +6714,15 @@ resolve_qualified_expression_name (wfl, 
  	  type = QUAL_DECL_TYPE (decl);
  	  continue;
  
 +	case PLUS_EXPR:
 +	  if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
 +	    return 1;
 +	  if ((type = patch_string (decl)))
 +	    decl = type;
 +	  *where_found = QUAL_RESOLUTION (q) = decl;
 +	  *type_found = type = TREE_TYPE (decl);
 +	  break;
 +
  	default:
  	  /* Fix for -Wall Just go to the next statement. Don't
               continue */
 @@ -7885,7 +7894,8 @@ qualify_ambiguous_name (id)
  	     TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
        name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
  
 -    else if (code == STRING_CST || code == CONDITIONAL_EXPR)
 +    else if (code == STRING_CST || code == CONDITIONAL_EXPR 
 +	     || code == PLUS_EXPR)
        {
  	qual = TREE_CHAIN (qual);
  	qual_wfl = QUAL_WFL (qual);
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Fri Nov  5 10:50:16 1999
State-Changed-Why:
    A patch was submitted.

From: apbianco@cygnus.com
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, kuipers@cwi.nl
Cc:  
Subject: Re: gcj/55
Date: 5 Nov 1999 18:50:16 -0000

 Synopsis: jc1 dies on implicit String conversion
 
 State-Changed-From-To: open->feedback
 State-Changed-By: apbianco
 State-Changed-When: Fri Nov  5 10:50:16 1999
 State-Changed-Why:
     A patch was submitted.
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=55

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/55
Date: Wed, 24 Nov 1999 17:54:40 -0800 (PST)

 apbianco@cygnus.com writes:
 
 >  State-Changed-From-To: open->feedback
 >  State-Changed-By: apbianco
 >  State-Changed-When: Fri Nov  5 10:50:16 1999
 >  State-Changed-Why:
 >      A patch was submitted.
 
 Anyone got a chance to check on the patch? I'd like to close this PR.
 
 ./A

From: Tom Tromey <tromey@cygnus.com>
To: Alexandre Petit-Bianco <apbianco@cygnus.com>
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/55
Date: Thu, 25 Nov 1999 00:13:58 -0800 (PST)

 Alex>  Anyone got a chance to check on the patch? I'd like to close this PR.
  
 I haven't had a chance to try it.  If libgcj builds with it, and it
 works for you, then I'd say check it in and close the PR (given its
 age).
 
 T
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Mon Nov 29 09:45:01 1999
State-Changed-Why:
    I checked in the following patch:
    
      http://egcs.cygnus.com/ml/gcc-patches/1999-11/msg00897.html

From: apbianco@cygnus.com
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, kuipers@cwi.nl
Cc:  
Subject: Re: gcj/55
Date: 29 Nov 1999 17:45:01 -0000

 Synopsis: jc1 dies on implicit String conversion
 
 State-Changed-From-To: feedback->closed
 State-Changed-By: apbianco
 State-Changed-When: Mon Nov 29 09:45:01 1999
 State-Changed-Why:
     I checked in the following patch:
     
       http://egcs.cygnus.com/ml/gcc-patches/1999-11/msg00897.html
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=55&database=java
>Unformatted:




More information about the Gcc-prs mailing list