This is the mail archive of the gcc-bugs@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]

java/3803: buggy code generation



>Number:         3803
>Category:       java
>Synopsis:       buggy code generation
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 24 16:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Stephan Goetter
>Release:        gcc-20010716
>Organization:
>Environment:
linux-x86-2.4, glibc-2.2
>Description:
Hi,

I tried to compile the rc5-version of the dnetc-client with gcj. after removing the appletcode and a litte patching
The compiler seems to produce bad code or optimize too much.
The program doesn't enter the inner loop so no output is written.

Happens of course only if I compile the java-files.
Not with the class files.

You can get it here:
http://www.hewgill.com/rc5/index.html

Here is my patch to remove the appletcode and get it working.

diff -u -r rc5java-orig/RC5demo.java rc5java/RC5demo.java
--- rc5java-orig/RC5demo.java	Mon Nov 10 21:59:48 1997
+++ rc5java/RC5demo.java	Sun Jul 22 15:46:36 2001
@@ -1,28 +1,8 @@
 // RC5 demo applet.
 
-import java.applet.Applet;
-import java.awt.BorderLayout;
-import java.awt.Button;
-import java.awt.Component;
-import java.awt.Event;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Label;
-import java.awt.Panel;
-import java.awt.TextField;
-
-public class RC5demo extends Applet {
-  private TextField KeysField;
-  private TextField TimeField;
-  private TextField RateField;
-  private Component GoButton;
+public class RC5demo{
   private boolean Standalone;
 
-  public RC5demo()
-  {
-    Standalone = false;
-  }
-
   public RC5demo(boolean standalone)
   {
     Standalone = standalone;
@@ -30,73 +10,14 @@
 
   public void init()
   {
-    setLayout(new BorderLayout());
-    Panel displaypanel = new Panel();
-    add(displaypanel);
-
-    GridBagLayout gb = new GridBagLayout();
-    displaypanel.setLayout(gb);
-    GridBagConstraints c = new GridBagConstraints();
-
-    c.fill = GridBagConstraints.HORIZONTAL;
-    gb.setConstraints(displaypanel.add(new Label("Keys tested: ", Label.RIGHT)), c);
-
-    c.gridwidth = GridBagConstraints.REMAINDER;
-    KeysField = new TextField(20);
-    KeysField.setEditable(false);
-    gb.setConstraints(displaypanel.add(KeysField), c);
-
-    c.gridwidth = 1;
-    gb.setConstraints(displaypanel.add(new Label("Elapsed time: ", Label.RIGHT)), c);
-
-    c.gridwidth = GridBagConstraints.REMAINDER;
-    TimeField = new TextField(20);
-    TimeField.setEditable(false);
-    gb.setConstraints(displaypanel.add(TimeField), c);
-
-    c.gridwidth = 1;
-    gb.setConstraints(displaypanel.add(new Label("Keyrate: ", Label.RIGHT)), c);
-
-    c.gridwidth = GridBagConstraints.REMAINDER;
-    RateField = new TextField(20);
-    RateField.setEditable(false);
-    gb.setConstraints(displaypanel.add(RateField), c);
-
-    c.fill = GridBagConstraints.NONE;
-    GoButton = new Button("Go!");
-    gb.setConstraints(displaypanel.add(GoButton), c);
-
-    add("Center", displaypanel);
-
-    add("North", new Label("RC5 Java Demo Applet (gregh@lightspeed.net)", Label.CENTER));
-  }
-
-  public boolean action(Event evt, Object what)
-  {
-    if (evt.target == GoButton) {
-      GoButton.disable();
-      new Thread(new RC5test(this)).start();
-    } else {
-      return super.action(evt, what);
-    }
-    return true;
   }
 
   void updateStats(long keys, long time, boolean done)
   {
     if (Standalone) {
-      if (done) {
         System.out.println("Keys: " + keys + " keys");
         System.out.println("Time: " + time + " ms");
         System.out.println("Rate: " + (1000*keys/time) + " keys/sec");
-      }
-    } else {
-      KeysField.setText(Long.toString(keys) + " keys");
-      TimeField.setText(Long.toString(time) + " ms");
-      RateField.setText(Long.toString(1000*keys/time) + " keys/sec");
-      if (done) {
-        GoButton.enable();
-      }
     }
   }
 
>How-To-Repeat:
just try to compile and run the rc5-java-demo
>Fix:
sorry, not available
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="rc5.patch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H0NCiAgIH0NCiANCg==


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