This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
y = (++x) + (++x)
- To: gcc-bugs at gcc dot gnu dot org
- Subject: y = (++x) + (++x)
- From: Andrey Panov <panov at iacp dot vl dot ru>
- Date: Fri, 18 Aug 2000 12:21:25 +1100
- Organization: Institute for Automation and Control Processes
- Reply-To: panov at iacp dot vl dot ru
I have compiled following program:
#include<stdio.h>
main(){
int x = 1, y;
y = (++x) + (++x);
printf("y = %d, x = %d", y, x);
}
It produces output y = 6, x = 3, while one can expect y = 5, x = 3.
I use gcc-2.95.2 from slackware-7.1 contrib tree.
My system is linux-2.2.16 running on Celeron.
And as I know this problen occures on another systems.
--
Andrey Panov
Institute for Automation and Control Processes,
Russian Academy of Sciences Far-Eastern Branch
E-mail: panov@iacp.vl.ru
panov@ifit.phys.dvgu.ru
ICQ UIN: 69875331