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]
Other format: [Raw text]

Bug in gcc


Hello,

The program below when excuted yields incorrect result:

main()
{
   int A,B,C;

   A=0; B=1;C=2;

   A = B++ + B++ + C++ + C++;

   printf("A:%d B:%d C:%d \n", A,B,C);
}
~
~
% gcc m.c
OUTPUT=> A:6 B:2 C:3  <<<<<incorrect value for B and C<<

After the assignment operation is complete,
the correct value for B is 3 and C is 4. 

Best Regards,
Swaminathan Venkat
vswami@agere.com


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