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 c/17095] New: ++ opertator and + operator is not working together.


main()
{
	int x=20,y=35;
	printf("1:%d%d\n",x,y);
	x=y++ + x++; //This operation is not working
	printf("2:%d%d\n",x,y);
	y= ++y + ++x;
	printf("3:%d%d\n",x,y);
}
	
If you compile the following program it gives  following output.

gcc(3.3.2) - Wrong output
------------
1:2035
2:2136
3:2259

Ideal output should be
----------------------
1:2035
2:5636
3:5794

-- 
           Summary: ++ opertator and + operator is not working together.
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: asokumar at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17095


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