java/10292: evaluation order of arguments when invoking native method

mamoru@moon.email.ne.jp mamoru@moon.email.ne.jp
Wed Apr 2 05:36:00 GMT 2003


>Number:         10292
>Category:       java
>Synopsis:       evaluation order of arguments when invoking native method
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 02 05:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Mamoru Kobayashi
>Release:        3.2.2
>Organization:
>Environment:
Solaris 9 Sparc
>Description:
When invoking a native method, the evaluation order of argument lists are not guaranteed (Java's methods are OK).

For example:

class XX {
  void foo( int a, int b ) {..}
  native void bar( int a, int b );
  void test() {
    int x = 0;
    foo( x, x += 1 );
    x = 0;
    bar( x, x += 1 );
  }
}

foo receives a=0, b=1
bar receives a=1, b=1 (in my environment)

See Java Languange Specification (2nd Edition) Sec. 15.7.4.
>How-To-Repeat:

>Fix:

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



More information about the Gcc-bugs mailing list