Bug 75750 - gcj - argument evaluation order problem
Summary: gcj - argument evaluation order problem
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 8.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-10-11 20:16 UTC by Anthony Green
Modified: 2007-04-18 16:47 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-10-11 20:16:35 UTC
Embargoed:


Attachments (Terms of Use)

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.


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