java/8204: gcj -O2 to native reorders certain instructions improperly.

Tom Tromey tromey@redhat.com
Tue Mar 25 22:46:00 GMT 2003


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

From: Tom Tromey <tromey@redhat.com>
To: bangerth@dealii.org
Cc: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, java-prs@gcc.gnu.org,
        nobody@gcc.gnu.org, rsdio@metastatic.org, gcc-gnats@gcc.gnu.org
Subject: Re: java/8204: gcj -O2 to native reorders certain instructions improperly.
Date: 25 Mar 2003 15:36:42 -0700

 >>>>> ">" == bangerth  <bangerth@dealii.org> writes:
 
 >>       (f(s.charAt(i++)) << 4) | (f(s.charAt(i++))))
 >>     I don't know enough about Java, but in C/C++ this will invoke
 >>     undefined behavior, since the standard doesn't prescribe
 >>     which of the two function calls happen first, and with
 >>     which value of i. Is this different in Java, i.e. does
 >>     the Java standard give guarantees as to the order in which
 >>     the sub-statements are executed?
     
 Yes, Java specifies left-to-right evaluation in this situation.
 
 Chances are that this bug is fixed, but I haven't tried it.
 
 Tom



More information about the Gcc-prs mailing list