Bug in gcc 3?

2010-06-01 Thread Tim van der Molen
I'm running i386 -current of 13 May and ran into surprising behaviour from gcc. Consider the following code snippet: int i; i = 1; if (i += 1 == 2) printf(%d; should be 2\n, i); i = 1; if ((i += 1) == 2) printf(%d; should

Re: Bug in gcc 3?

2010-06-01 Thread Joerg Sonnenberger
On Tue, Jun 01, 2010 at 09:14:53PM +0200, Tim van der Molen wrote: Would this be a bug in gcc or am I overlooking something? == has a higher precendence than += and therefore binds stronger. See operator(7). Joerg

Re: Bug in gcc 3?

2010-06-01 Thread Nikolai Fetissov
I'm running i386 -current of 13 May and ran into surprising behaviour from gcc. Consider the following code snippet: int i; i = 1; if (i += 1 == 2) printf(%d; should be 2\n, i); i = 1; if ((i += 1) == 2) printf(%d; should be

Re: Bug in gcc 3?

2010-06-01 Thread Jonathan Gray
On Tue, Jun 01, 2010 at 09:14:53PM +0200, Tim van der Molen wrote: I'm running i386 -current of 13 May and ran into surprising behaviour from gcc. Consider the following code snippet: int i; i = 1; if (i += 1 == 2) printf(%d; should be 2\n, i); i