This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/41246] should "sorry" when regparm=3 and nested functions are encountered
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Sep 2009 18:05:23 -0000
- Subject: [Bug target/41246] should "sorry" when regparm=3 and nested functions are encountered
- References: <bug-41246-12496@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from pinskia at gcc dot gnu dot org 2009-09-03 18:05 -------
(In reply to comment #11)
> Subject: Re: should "sorry" when regparm=3 and nested functions are
> encountered
>
> 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.
It is valid as GCC creates a trampoline for the function pointer ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41246