Reto Buerki wrote: > Actually these cases are not so rare. As soon as you use Ada.Containers > you are almost there. 'Access to a nested function is enough. The > following code illustrates this:
Thanks for the nice reproducer. [...] > The stack of the resulting binary is executable: > > GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 > 0x0000000000000000 0x0000000000000000 RWE 8 > > Tested with gnat in Lenny, Squeeze and sid (amd64/i386). > > It's interesting that the same code compiled with GNAT GPL 2010 does not > result in an executable stack: > > GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 > 0x0000000000000000 0x0000000000000000 RW 8 > > Since an executable stack is not very nice I think it would be > interesting if we could identify the patch which is responsible for this > behavior. Maybe we could port it to work with 4.6.0. AFAICT, there are several: 2008-05-28 Eric Botcazou <[email protected]> * system-lynxos-ppc.ads (Always_Compatible_Rep): Set to False. * system-lynxos-x86.ads (Always_Compatible_Rep): Set to False. 2008-05-27 Bob Duff <[email protected]> * gnat_rm.texi: Document the new behavior regarding trampolines. 2008-05-27 Eric Botcazou <[email protected]> * system-darwin-ppc.ads (Always_Compatible_Rep): Set to False. * system-darwin-x86.ads (Always_Compatible_Rep): Likewise. * system-freebsd-x86.ads (Always_Compatible_Rep): Likewise. * system-linux-ppc.ads (Always_Compatible_Rep): Likewise. * system-linux-x86_64.ads (Always_Compatible_Rep): Likewise. * system-linux-x86.ads (Always_Compatible_Rep): Likewise. * system-mingw.ads (Always_Compatible_Rep): Likewise. * system-solaris-sparc.ads (Always_Compatible_Rep): Likewise. * system-solaris-sparcv9.ads (Always_Compatible_Rep): Likewise. * system-solaris-x86.ads (Always_Compatible_Rep): Likewise. 2008-05-25 Eric Botcazou <[email protected]> * trans.c (Attribute_to_gnu) <Code_Address>: Set TREE_NO_TRAMPOLINE instead of TREE_STATIC on the ADDR_EXPR. All these patches are already in gnat-4.4 because the commits took place during Stage 1 of the GCC 4.4 cycle, so your results for Squeeze and sid surprise me. Anyway, I anticipate that the stack will not be executable with gnat-4.6, just like with GNAT GPL 2010. -- Ludovic Brenta. -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/7a53282ea77bb3336d72dbcb9f1ff5fa@localhost
