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]

y = (++x) + (++x)


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


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