public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/6519: Empty Strings cannot always be optimized away
@ 2002-05-04  6:37 mark
  0 siblings, 0 replies; 2+ messages in thread
From: mark @ 2002-05-04  6:37 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, mark, nobody

Synopsis: Empty Strings cannot always be optimized away

State-Changed-From-To: open->closed
State-Changed-By: mark
State-Changed-When: Sat May  4 06:37:27 2002
State-Changed-Why:
    I checked in the patch.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6519


^ permalink raw reply	[flat|nested] 2+ messages in thread

* java/6519: Empty Strings cannot always be optimized away
@ 2002-04-30 12:56 mark
  0 siblings, 0 replies; 2+ messages in thread
From: mark @ 2002-04-30 12:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6519
>Category:       java
>Synopsis:       Empty Strings cannot always be optimized away
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 30 12:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     mark@klomp.org
>Release:        gcj 3.1
>Organization:
>Environment:

>Description:
The following program returns false, but should return true:

public class SN
{
        public static void main(String[] args)
        {
                System.out.println("null".equals(n(0) + ""));
        }

        static String n(int i)
        {
                if (i==0) return null; else return "x";
        }
}

The problem is that the String concatenation gets optimized away and
since n(0) returns null it does not generate the string "null" but it
generates the value null. The problem disappears when the return type of
n() is changed to Object.

It is also responsible for the following Mauve test failure:
FAIL: gnu.testlet.java.lang.StringBuffer.plus (number 1)
>How-To-Repeat:

>Fix:
See the following patch:
http://gcc.gnu.org/ml/gcc-patches/2002-04/msg01019.html
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-04 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-04  6:37 java/6519: Empty Strings cannot always be optimized away mark
  -- strict thread matches above, loose matches on Subject: below --
2002-04-30 12:56 mark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).