Bug 75750

Summary: gcj - argument evaluation order problem
Product: [Retired] Red Hat Linux Reporter: Anthony Green <green>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: mitr
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-10-11 20:16:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anthony Green 2002-10-11 20:16:27 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
Here's a bug in how gcj evaluated 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 -O2 -march=i386 -mcpu=i686
[green@build green]$ ./bug
0
0
1

This is bad output...

[green@build green]$ gcj -o bug --main=bug bug.java -O2 -march=i386 -mcpu=i386
[green@build green]$ ./bug
0
1
1


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
See description.

Actual Results:  See description.

Expected Results:  See description.

Additional info:

gcj is miscompiling part of libgcj (like StringTokenizer) because of this bug.

Comment 1 Jakub Jelinek 2002-10-18 20:31:29 UTC
Fixed in gcc-3.2-10.