public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/6820: miscompilation of (a,++a) as arguments to final method
@ 2002-07-01 19:57 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-07-01 19:57 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, oskar, tromey

Synopsis: miscompilation of (a,++a) as arguments to final method

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Mon Jul  1 19:57:39 2002
Responsible-Changed-Why:
    I'm handling the administrivia
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Mon Jul  1 19:57:39 2002
State-Changed-Why:
    Bryce checked in a fix for this a while ago,
    so I'm closing the PR.

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


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

* Re: java/6820: miscompilation of (a,++a) as arguments to final method
@ 2002-05-26 23:56 Bryce McKinlay
  0 siblings, 0 replies; 3+ messages in thread
From: Bryce McKinlay @ 2002-05-26 23:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR java/6820; it has been noted by GNATS.

From: Bryce McKinlay <bryce@waitaki.otago.ac.nz>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: java/6820: miscompilation of (a,++a) as arguments to final method
Date: Mon, 27 May 2002 17:53:33 +1200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6820
 
 I checked in a similar test case to the testsuite:
 
 public class PR6820
 {
   static void m(int a, int b) {
     System.out.println("a="+a+" b="+b);
   }
 
   static int a = 10;
 
   public static void main(String[] args) {
     int b = 10;
     m(a,++a);
     m(b,++b);
   }
 }
 
 This appears to be a problem with the (deprecated) RTL inliner which is 
 still used by gcj. When a call is inlined, the Java evalutation order 
 for the arguments (set by force_evaluation_order() in java/expr.c) seems 
 to get lost.
 
 Workaround is to compile with -O2 -fno-inline
 
 Solution may be to switch gcj to use the AST inliner.
 
 


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

* java/6820: miscompilation of (a,++a) as arguments to final method
@ 2002-05-26 11:26 Oskar Liljeblad
  0 siblings, 0 replies; 3+ messages in thread
From: Oskar Liljeblad @ 2002-05-26 11:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6820
>Category:       java
>Synopsis:       miscompilation of (a,++a) as arguments to final method
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 26 10:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Oskar Liljeblad <oskar@osk.mine.nu>
>Release:        3.1
>Organization:
>Environment:
Linux/x86
>Description:
(Let's hope this is not a dupe...)

See the code below. With Demo compiled with gcj from source to x86 machine code, the output is "a=11 b=11". The output is correctly "a=10 b=11" when:

 * compiling and running with Sun JDK 1.4 javac.

 * compiling from source to .class and interpreting
   with gij.

 * compiling from source to .class, and .class to
   machine code with gcj.

Note that this bug only happens when calling methods that are final (or in final classes).

Oskar Liljeblad (oskar@osk.mine.nu)
>How-To-Repeat:
class Demo {
	public static void main(String[] args) {
		Dummy d = new Dummy();
		int a = 10;
		d.m(a,++a);
	}
}

final class Dummy {
	public void m(int a, int b) {
		System.out.println("a="+a+" b="+b);
	}
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-07-02  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-01 19:57 java/6820: miscompilation of (a,++a) as arguments to final method tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-05-26 23:56 Bryce McKinlay
2002-05-26 11:26 Oskar Liljeblad

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