This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
frontend bug?
- From: Alex Turjan <aturjan at yahoo dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: tjvries at xs4all dot nl, tom at codesourcery dot com
- Date: Wed, 29 Dec 2010 08:06:02 -0800 (PST)
- Subject: frontend bug?
Hi all,
Im compiling the code bellow for x86 with gcc 4.4.3 and 4.5. Is it correct
that at the end of main the value of variable b should have been 4? When
executing I get value 3.
#include "stdio.h"
int *ptr;
int inc(void){
(*ptr)++;
return 1;
}
int main (void){
int a, b = 2;
ptr = &b;
b++ + inc() ;
if(b==4)
printf("correct\n");
else
printf("incorrect %d\n",b);
return 1;
}