This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/816: function parameters incorrect order when using ++ as a parameter



>Number:         816
>Category:       c++
>Synopsis:       function parameters incorrect order when using ++ as a parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 15 13:16:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     matt clark
>Release:        gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
>Organization:
>Environment:
Linux substitute 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown   
>Description:
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.

>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!
>Fix:
Can code around it and maybe fixed in newer g++, 
can't find it in the bug list. 
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test1.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test1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nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]