Bug 75750 - gcj - argument evaluation order problem
gcj - argument evaluation order problem
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
8.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-11 16:16 EDT by Anthony Green
Modified: 2007-04-18 12:47 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-10-11 16:16:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Anthony Green 2002-10-11 16:16:27 EDT
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 16:31:29 EDT
Fixed in gcc-3.2-10.

Note You need to log in before you can comment on or make changes to this bug.