Re: Fwd: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-08 Thread Robert Millan
On Sun, Sep 06, 2009 at 07:12:45PM +0200, Vladimir 'phcoder' Serbinenko wrote: > > We do file the bugs, but we recognize that 1) the fix won't > propagate for months, if that and 2) requiring a compiler update > decreases our testing base which is the most important thing we > have. > > Do you ge

Fwd: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-06 Thread Vladimir 'phcoder' Serbinenko
-- Forwarded message -- From: David Miller Date: Sun, Sep 6, 2009 at 12:23 AM Subject: Re: [RFC] Eliminate NESTED_ATTR_FUNC To: phco...@gmail.com From: "Vladimir 'phcoder' Serbinenko" Date: Sat, 5 Sep 2009 23:04:00 +0200 > On Fri, Sep 4, 2009 at 1:17

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread David Miller
From: "Vladimir 'phcoder' Serbinenko" Date: Thu, 3 Sep 2009 17:08:34 +0200 > I can't agree with designating nested functions as root issue. Imagine > tomorrow we discover a bug in "for" loop compiling. This wouldn't be a > reason to replace all "for"s with "while"s. The root issue is compiler > b

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Vladimir 'phcoder' Serbinenko
On Thu, Sep 3, 2009 at 5:54 PM, Paolo Bonzini wrote: > >>> #include >>> >>> void foo (int a, int b, void (*hook) (int aa, int bb, int cc)) >>> { >>>  b += a; >>>  hook (a, b, a + b); >>> } >>> >>> void qq (int a) >>> { >>>  auto void q1 (int aa, int bb, int cc); >>>  void q1 (int aa, int bb, int cc

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Bean
On Thu, Sep 3, 2009 at 11:49 PM, Felix Zielcke wrote: > Am Donnerstag, den 03.09.2009, 17:36 +0200 schrieb Robert Millan: >> On Wed, Sep 02, 2009 at 12:20:19PM +0800, Bean wrote: >> > >> > Hi, >> > >> > Oh, I was wrong previously, gcc does respect __attribute__ >> > ((__regparm__ (3))) flag (I forg

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Vladimir 'phcoder' Serbinenko
On Thu, Sep 3, 2009 at 5:49 PM, Felix Zielcke wrote: > Am Donnerstag, den 03.09.2009, 17:36 +0200 schrieb Robert Millan: >> On Wed, Sep 02, 2009 at 12:20:19PM +0800, Bean wrote: >> > >> > Hi, >> > >> > Oh, I was wrong previously, gcc does respect __attribute__ >> > ((__regparm__ (3))) flag (I forge

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Felix Zielcke
Am Donnerstag, den 03.09.2009, 17:36 +0200 schrieb Robert Millan: > On Wed, Sep 02, 2009 at 12:20:19PM +0800, Bean wrote: > > > > Hi, > > > > Oh, I was wrong previously, gcc does respect __attribute__ > > ((__regparm__ (3))) flag (I forget to add -Os so it still uses stack > > to store value). An

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Robert Millan
On Wed, Sep 02, 2009 at 12:20:19PM +0800, Bean wrote: > > Hi, > > Oh, I was wrong previously, gcc does respect __attribute__ > ((__regparm__ (3))) flag (I forget to add -Os so it still uses stack > to store value). And the bug is still there ! Try this test program: Thanks Bean. I have opened a

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Vladimir 'phcoder' Serbinenko
On Wed, Sep 2, 2009 at 12:26 AM, David Miller wrote: > From: Yves Blusseau > Date: Tue, 1 Sep 2009 21:30:01 +0200 > >> >> Le 1 sept. 09 à 17:43, Bean a écrit : >> >>> IMO, if we are to tackle the NESTED_FUNC_ATTR issue, we should do it >>> properly by removing nested function, this also has other

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-03 Thread Vladimir 'phcoder' Serbinenko
> Hi, > > Oh, I was wrong previously, gcc does respect __attribute__ > ((__regparm__ (3))) flag (I forget to add -Os so it still uses stack > to store value). And the bug is still there ! Try this test program: I confirm with gcc-4.4 This is a grave problem then. This check was added by Marco Gerar

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Yves Blusseau
Oh, I was wrong previously, gcc does respect __attribute__ ((__regparm__ (3))) flag (I forget to add -Os so it still uses stack to store value). And the bug is still there ! Try this test program: Compile with: gcc -m32 -mregparm=3 -Os test.c ./a.out 10 31 -6674368 gcc is 4.3.4 from debian.

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Bean
On Tue, Sep 1, 2009 at 11:43 PM, Bean wrote: > I make an assembly dump of the code generated by gcc-4.2. Apparently, > the "FIX" is achieved by ignoring the regparm attribute at all. > __attribute__ ((__regparm__ (3))) doesn't have any effect any more, it > always pass the parameters on the stack.

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread David Miller
From: Yves Blusseau Date: Tue, 1 Sep 2009 21:30:01 +0200 > > Le 1 sept. 09 à 17:43, Bean a écrit : > >> IMO, if we are to tackle the NESTED_FUNC_ATTR issue, we should do it >> properly by removing nested function, this also has other advantages, >> like allowing to run tools on systems like OSX

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Yves Blusseau
Le 1 sept. 09 à 17:43, Bean a écrit : On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder' Serbinenko wrote: Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug in compiler. Now it creates only problems. In particular if they are used wrong it creates a bug of argument passi

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Bean
On Tue, Sep 1, 2009 at 11:43 PM, Bean wrote: > On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder' > Serbinenko wrote: >> Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug >> in compiler. Now it creates only problems. In particular if they are >> used wrong it creates a bug of a

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Robert Millan
On Tue, Sep 01, 2009 at 11:43:10PM +0800, Bean wrote: > On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder' > Serbinenko wrote: > > Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug > > in compiler. Now it creates only problems. In particular if they are > > used wrong it create

Re: [RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Bean
On Tue, Sep 1, 2009 at 9:42 PM, Vladimir 'phcoder' Serbinenko wrote: > Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug > in compiler. Now it creates only problems. In particular if they are > used wrong it creates a bug of argument passing. Such bugs are > difficult to find b

[RFC] Eliminate NESTED_ATTR_FUNC

2009-09-01 Thread Vladimir 'phcoder' Serbinenko
Hello. NESTED_ATTR_FUNC was introduced 6 years ago to workaround a bug in compiler. Now it creates only problems. In particular if they are used wrong it creates a bug of argument passing. Such bugs are difficult to find because it usually results in strange behaviour and in grub-emu NESTED_FUNC_AT