All,

nested functions get passed a hidden argumment akin to static link/display
so that nested function can access the locals of its enclosing function.

Passing a nested function as parameter to another function isn't going 
to work correctly when the function is eventually called the
hidden argument isn't going to be setup correctly.

I think the code is thus invalid and GCC should reject it.

Regards
Graham

--- On Thu, 3/9/09, bonzini at gnu dot org <gcc-bugzi...@gcc.gnu.org> wrote:

> From: bonzini at gnu dot org <gcc-bugzi...@gcc.gnu.org>
> Subject: [Bug target/41246] should "sorry" when regparm=3 and nested 
> functions are encountered
> To: gcc-bugs@gcc.gnu.org
> Date: Thursday, 3 September, 2009, 6:11 PM
> 
> 
> ------- Comment #5 from bonzini at gnu dot org 
> 2009-09-03 17:11 -------
> Yes, if you use nested functions you can just use
> -mregparm=2 globally, that's
> a much better solution.
> 
> 
> -- 
> 
> bonzini at gnu dot org changed:
> 
>            What 
>   |Removed           
>          |Added
> ----------------------------------------------------------------------------
>          
>    Status|UNCONFIRMED     
>            |NEW
>      Ever Confirmed|0   
>                
>        |1
>    Last reconfirmed|0000-00-00
> 00:00:00         |2009-09-03
> 17:11:30
>            
>    date|         
>                
>   |
>             Summary|%ecx
> corruption when        |should "sorry"
> when
>                
>    |combining -regparm=3
> with   |regparm=3 and nested
>                
>    |nested functions     
>       |functions are encountered
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41246
> 
>


Reply via email to