public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/5354: function call with two statement expressions yields incorrect result
@ 2002-03-20 18:06 rth
0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-03-20 18:06 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, liblit, nobody, rth
Synopsis: function call with two statement expressions yields incorrect result
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Wed Mar 20 18:06:03 2002
Responsible-Changed-Why:
.
State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Wed Mar 20 18:06:03 2002
State-Changed-Why:
http://gcc.gnu.org/ml/gcc-patches/2002-02/msg00958.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5354
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/5354: function call with two statement expressions yields incorrect result
@ 2002-03-21 1:42 rth
0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-03-21 1:42 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, liblit, rth
Synopsis: function call with two statement expressions yields incorrect result
State-Changed-From-To: analyzed->closed
State-Changed-By: rth
State-Changed-When: Thu Mar 21 01:41:58 2002
State-Changed-Why:
http://gcc.gnu.org/ml/gcc-patches/2002-03/msg01302.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5354
^ permalink raw reply [flat|nested] 3+ messages in thread
* c/5354: function call with two statement expressions yields incorrect result
@ 2002-01-10 16:26 Ben Liblit
0 siblings, 0 replies; 3+ messages in thread
From: Ben Liblit @ 2002-01-10 16:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 5354
>Category: c
>Synopsis: function call with two statement expressions yields incorrect result
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Jan 10 16:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Ben Liblit <liblit@cs.berkeley.edu>
>Release: 3.1 20020110 (experimental)
>Organization:
Computer Science Division, UC Berkeley
>Environment:
System: Linux brawnix.CS.Berkeley.EDU 2.4.17 #4 Fri Dec 28 23:34:16 PST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../src/configure --prefix=/var/local/liblit/gcc-cvs/install
>Description:
When calling a function where two arguments are computed using ({...})
statement expressions, the generated code computes the incorrect
value for one of the arguments. Specifically, it appears that
whichever statement expression is computed *last* is taken as the
value for *both* arguments.
>How-To-Repeat:
Compile and run the following code:
------------------------------------------------------------------------
extern int printf(__const char *__restrict __format, ...);
void f(int x, int y)
{
printf("f(%d, %d)\n", x, y);
}
int main()
{
f(({ int temp1 = 1; temp1; }),
({ int temp2 = 2; temp2; }));
return 0;
}
------------------------------------------------------------------------
gcc-2.96 produces the correct output:
f(1, 2)
gcc-3.0.1, which computes the arguments for the call to g from right
to left, produces the following incorrect output:
f(1, 1)
gcc CVS snapshot as of 10-Jan-2002, which computes the arguments for
the call to g from left to right, produces the following incorrect
output:
f(2, 2)
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-03-21 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-20 18:06 c/5354: function call with two statement expressions yields incorrect result rth
-- strict thread matches above, loose matches on Subject: below --
2002-03-21 1:42 rth
2002-01-10 16:26 Ben Liblit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).