public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* frontend bug?
@ 2010-12-29 16:06 Alex Turjan
  0 siblings, 0 replies; only message in thread
From: Alex Turjan @ 2010-12-29 16:06 UTC (permalink / raw)
  To: gcc-bugs; +Cc: tjvries, tom

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;
}



      


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-29 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 16:06 frontend bug? Alex Turjan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).