This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
java/8219: gcj order of argument evaluation problem
- From: green at redhat dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sun, 13 Oct 2002 23:27:22 -0700
- Subject: java/8219: gcj order of argument evaluation problem
>Number: 8219
>Category: java
>Synopsis: gcj order of argument evaluation problem
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sun Oct 13 23:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.3 20021005 (experimental)
>Organization:
>Environment:
System: Linux louie 2.4.7-10smp #1 SMP Thu Sep 6 17:09:31 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/green/FSF/GCC/HEAD/gcc/configure --prefix=/louie/green/latest/i --enable-languages=c,c++,java : (reconfigured)
>Description:
Here's a bug in how gcj evaluates method arguments....
public class bug
{
private static int first (int x, int y)
{
return x;
}
public static void main (String[] args)
{
int l = args.length;
/* This should print:
0
0
1
*/
System.out.println (l);
System.out.println (first (l, ++l));
System.out.println (l);
}
}
This is correct output...
[green@build green]$ gcj -o bug --main=bug bug.java -O0
[green@build green]$ ./bug
0
0
1
This is bad output...
[green@build green]$ gcj -o bug --main=bug bug.java -O2
[green@build green]$ ./bug
0
1
1
Is looks as though the rtl we're generating is bad from the start - so
it's unlikely to be a problem with any on the rtl-based optimizations.
>How-To-Repeat:
See above.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: