public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/14818] New: gcj: boolean value changes with -Os
@ 2004-04-02  3:04 ovidr at users dot sourceforge dot net
  2004-04-02  3:16 ` [Bug java/14818] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ovidr at users dot sourceforge dot net @ 2004-04-02  3:04 UTC (permalink / raw)
  To: java-prs

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class gc
{
  static public void main (String[] s)
  {
   bla(false);
  }

  static void bla(boolean b) {
    System.out.println("1 - now: " + b);

    try {
      Socket socket = new Socket("localhost", 8888);
    } catch (IOException e) {
      System.out.println("2 - now: " +  b);
    }
  }
}

/*

linux
gcc version 3.4.0 20040131 (prerelease)

results:
gcj --main=gc gc.java
1 - now: false
2 - now: false

gcj --main=gc -Os gc.java
1 - now: false
2 - now: true

*/

-- 
           Summary: gcj: boolean value changes with -Os
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ovidr at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14818


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

* [Bug java/14818] gcj: boolean value changes with -Os
  2004-04-02  3:04 [Bug java/14818] New: gcj: boolean value changes with -Os ovidr at users dot sourceforge dot net
@ 2004-04-02  3:16 ` pinskia at gcc dot gnu dot org
  2004-04-02  3:24 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-02  3:16 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-02 03:16 -------
I think this is related to bug 10878.
Confirmed on the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to work|                            |3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-02 03:16:07
               date|                            |
            Summary|gcj: boolean value changes  |gcj: boolean value changes
                   |with -Os                    |with -Os


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14818


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

* [Bug java/14818] gcj: boolean value changes with -Os
  2004-04-02  3:04 [Bug java/14818] New: gcj: boolean value changes with -Os ovidr at users dot sourceforge dot net
  2004-04-02  3:16 ` [Bug java/14818] " pinskia at gcc dot gnu dot org
@ 2004-04-02  3:24 ` pinskia at gcc dot gnu dot org
  2004-04-02  4:02 ` ovidr at users dot sourceforge dot net
  2004-07-02  0:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-02  3:24 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-02 03:24 -------
This might be fixed on the tree-ssa.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14818


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

* [Bug java/14818] gcj: boolean value changes with -Os
  2004-04-02  3:04 [Bug java/14818] New: gcj: boolean value changes with -Os ovidr at users dot sourceforge dot net
  2004-04-02  3:16 ` [Bug java/14818] " pinskia at gcc dot gnu dot org
  2004-04-02  3:24 ` pinskia at gcc dot gnu dot org
@ 2004-04-02  4:02 ` ovidr at users dot sourceforge dot net
  2004-07-02  0:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ovidr at users dot sourceforge dot net @ 2004-04-02  4:02 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From ovidr at users dot sourceforge dot net  2004-04-02 04:02 -------
Here is another phenomenon:

>From the following class,

If you put
int i = b ? 1 : 0;
before the 
System.out.println("1 - now: " + b);

it is wrong. Result:
1 - now: false
i is: 0
2 - now: true
3 - is i > 0? true

(i is not > 0).

But, if you put the println first, the result is corrent. (3 - is i > 0? 
false).

Must use -Os: gcj --main=gc -Os gc.java

---

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class gc
{
  static public void main (String[] s)
  {
   bla(false);
  }

  static void bla(boolean b) {
    int i = b ? 1 : 0;
    System.out.println("1 - now: " + b);

    System.out.println("i is: " + i);

    try {
      Socket socket = new Socket("localhost", 8888);
    } catch (IOException e) {
      System.out.println("2 - now: " + b);
      bla2(i > 0);
    }
  }

  static void bla2(boolean b) {
    System.out.println("3 - is i > 0? " + b);
  }

}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14818


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

* [Bug java/14818] gcj: boolean value changes with -Os
  2004-04-02  3:04 [Bug java/14818] New: gcj: boolean value changes with -Os ovidr at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2004-04-02  4:02 ` ovidr at users dot sourceforge dot net
@ 2004-07-02  0:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-02  0:30 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-02 00:30 -------
Fixed in 3.5.0

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14818


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

end of thread, other threads:[~2004-07-02  0:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-02  3:04 [Bug java/14818] New: gcj: boolean value changes with -Os ovidr at users dot sourceforge dot net
2004-04-02  3:16 ` [Bug java/14818] " pinskia at gcc dot gnu dot org
2004-04-02  3:24 ` pinskia at gcc dot gnu dot org
2004-04-02  4:02 ` ovidr at users dot sourceforge dot net
2004-07-02  0:30 ` pinskia at gcc dot gnu dot org

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).