Bug 816

Summary: function parameters incorrect order when using ++ as a parameter
Product: gcc Reporter: super.aorta
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gcc-bugs, nathan
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: test1.cc

Description super.aorta 2000-11-15 13:16:01 UTC
Compiler generates unexpected code when the ++ command is 
used in function parameters.  The compiler seems to reverse
the order of the parameters (see code it is much easier to
view, than to describe)

I don't know if this is C++ legal to do this, but it is 
the reverse of everything I am used to and a bit irritating.  
I will download the latest version of g++ and test it 
(manana).

I don't know if it even belongs to g++ yet.
Thanks m
NOT present in g++ gcc version 2.8.1.

Release:
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

Environment:
Linux substitute 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown

How-To-Repeat:
// UNDER 2.91.66 with BUG
g++ test1.cc -o test1
test1
This is matts compiler test program 1
6 5 4 3 2 1             // incorrect
This is test_fun
6 5 4 3 2 1             // incorrect
This is test_fun
6 5 4 3 2 1             // incorrect
This is test_fun
1 2 3 4 5 6             // correct
This is test_fun
1 2 3 4 5 6     
// correct
// BY COMPARISON
// UNDER 2.8.1 with NO BUG
test1
 This is matts compiler test program 1
1 2 3 4 5 6
This is test_fun
1 2 3 4 5 6
This is test_fun
1 2 3 4 5 6
This is test_fun
1 2 3 4 5 6
This is test_fun
1 2 3 4 5 6      
// correct every time!
Comment 1 super.aorta 2000-11-15 13:16:01 UTC
Fix:
Can code around it and maybe fixed in newer g++, 
can't find it in the bug list.
Comment 2 Nathan Sidwell 2000-11-17 08:51:36 UTC
State-Changed-From-To: open->closed
State-Changed-Why: you've invoked undefined effects. There are no sequence
    points between evaluating function arguments.
Comment 3 Nathan Sidwell 2000-11-17 16:51:36 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, super.aorta@ntlworld.com
Cc:  
Subject: Re: c++/816
Date: 17 Nov 2000 16:51:36 -0000

 Synopsis: function parameters incorrect order when using ++ as a parameter
 
 State-Changed-From-To: open->closed
 State-Changed-By: nathan
 State-Changed-When: Fri Nov 17 08:51:36 2000
 State-Changed-Why:
     you've invoked undefined effects. There are no sequence
     points between evaluating function arguments.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=816&database=gcc
Comment 4 Wolfgang Bangerth 2004-08-13 16:01:37 UTC
Reopening to mark as a duplicate of... 
Comment 5 Wolfgang Bangerth 2004-08-13 16:03:12 UTC
...PR 11751. 

*** This bug has been marked as a duplicate of 11751 ***