c/8030: strange behaviour of side effect operator
achille.fouilleul@gambro.com
achille.fouilleul@gambro.com
Wed Sep 25 03:46:00 GMT 2002
>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:
More information about the Gcc-bugs
mailing list