This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/8030: strange behaviour of side effect operator
- From: achille dot fouilleul at gambro dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 25 Sep 2002 09:36:14 -0000
- Subject: c/8030: strange behaviour of side effect operator
- Reply-to: achille dot fouilleul at gambro dot com
>Number: 8030
>Category: c
>Synopsis: strange behaviour of side effect operator
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 25 02:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: achille.fouilleul@gambro.com
>Release: gcc-2.95
>Organization:
>Environment:
both Linux and Cygwin
>Description:
Let's consider the following code:
int main() {
int a = 1;
int b;
b = a++ + a;
printf("%i\n", b);
return 0;
}
this prints "2" with GCC, whereas it prints "3" with CodeWarrior and Lcc.
Hint: I saw that in the assembler output the incrementation statement occurs AFTER the addition one.
>How-To-Repeat:
Just compile it! "gcc bug.c -o bug"
>Fix:
Dunno. Not a gcc expert!
>Release-Note:
>Audit-Trail:
>Unformatted: