Re: gcc miscompiling duff's device (probaby two different bugs)

2010-03-04 Thread Peter Kourzanov
eful attention, just like the goto. So combining it a-la Tom Duff with another construct blessed by Dijkstra, the for loop, can sometimes lead to unexpected results. Pjotr On Tue, 2010-03-02 at 14:07 +0100, Peter Kourzanov wrote: > On Tue, 2010-03-02 at 12:26 +0100, Richard Guenther wrote: >

Re: gcc miscompiling duff's device (probaby two different bugs)

2010-03-02 Thread Peter Kourzanov
On Tue, 2010-03-02 at 12:26 +0100, Richard Guenther wrote: > On Tue, Mar 2, 2010 at 12:00 PM, Pjotr Kourzanov > wrote: > > On Tue, 2010-03-02 at 10:47 +, Andrew Haley wrote: > >> On 03/02/2010 10:34 AM, Pjotr Kourzanov wrote: > >> > >> >> int duff4_fails(char * dst,const char * src,const size

gcc miscompiling duff's device (probaby two different bugs)

2010-03-02 Thread Peter Kourzanov
Hi guys, I have the following variation on Duff's device that seems to mis-compile on all GCC versions I can access within a minute (that is gcc-3.{3,4}, gcc-4.{1,2,3,4} on x86 and gcc-4.3.2 on x86_64). The symptoms are as follows: $ gcc-4.4 -o duffbug duffbug.c ; ./duffbug { he��3) { hello

Re: sizeof(array) with variable-length array parameter

2008-04-09 Thread peter . kourzanov
On Wed, Apr 09, 2008 at 01:22:15PM +0100, Andrew Haley wrote: > [EMAIL PROTECTED] wrote: > > Dear gcc users and developers, > > > > This might be a stupid question, nevertheless... > > > > I've been wondering for a long time, why the behaviour of > > variable-length arrays w.r.t. the sizeof

sizeof(array) with variable-length array parameter

2008-04-09 Thread peter . kourzanov
Dear gcc users and developers, This might be a stupid question, nevertheless... I've been wondering for a long time, why the behaviour of variable-length arrays w.r.t. the sizeof operator is different for local/auto variables and for function arguments (in C99): #include void foo(int s, in