[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c/11751] New: wrong evaluation of an expression
From:       "me at elitsa dot net" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2003-07-31 17:52:02
[Download RAW message or body]

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: wrong evaluation of an expression
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: me at elitsa dot net
                CC: gcc-bugs at gcc dot gnu dot org

bellow is simple code that express this bug:

/************
 * File : b.C
 ************/

#include <stdio.h>

int main()
        {
        int a = 1;
        printf(" a = %i \n",(a++)+(++a));               //4

        a = 1;
        printf(" a = %i \n",(a++)+(a++)+(++a));         //4

        return 0;
        }






After compilation in a following way:

c++ -o b b.C

The result was:

 a = 4 
 a = 4
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic