public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: mark@klomp.org To: gcc-gnats@gcc.gnu.org Subject: java/6519: Empty Strings cannot always be optimized away Date: Tue, 30 Apr 2002 12:56:00 -0000 [thread overview] Message-ID: <20020430194945.27430.qmail@sources.redhat.com> (raw) >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:
next reply other threads:[~2002-04-30 19:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-30 12:56 mark [this message] 2002-05-04 6:37 mark
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020430194945.27430.qmail@sources.redhat.com \ --to=mark@klomp.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).