[Ada] Fix crash on complicated mix of limited with and generics
Eric Botcazou
ebotcazou@adacore.com
Fri Jan 27 09:23:00 GMT 2012
This isn't a regression either, but the fix shouldn't change the generated
code. It's a crash on code involving a complicated mix of limited with and
generics. As usual with limited with, we have an underlying circularity and
we should break it on the pointer whose designated type is a limited view.
Except that, in this case, this goes through a static dispatch table: the
pointer is a function pointer so the existing mechanism doesn't apply.
As devising a more general mechanism seems overkill to me at this point, I came
up with the attached patch which deals with dispatch tables specially.
Tested on i586-suse-linux, applied on the mainline.
2012-01-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (get_minimal_subprog_decl): Declare.
* gcc-interface/decl.c (get_minimal_subprog_decl): New function.
* gcc-interface/trans.c (Attribute_to_gnu): Use it for the prefix of an
Access-like attribute in a dispatch table if the subprogram is public.
2012-01-27 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/limited_with3.ad[sb): New test.
* gnat.dg/limited_with3_pkg1.ad[sb]: New helper.
* gnat.dg/limited_with3_pkg2.ads: Likewise.
* gnat.dg/limited_with3_pkg3.ads: Likewise.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 5122 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3.adb
Type: text/x-adasrc
Size: 137 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3.ads
Type: text/x-adasrc
Size: 298 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3_pkg1.ads
Type: text/x-adasrc
Size: 788 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3_pkg1.adb
Type: text/x-adasrc
Size: 467 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3_pkg2.ads
Type: text/x-adasrc
Size: 181 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: limited_with3_pkg3.ads
Type: text/x-adasrc
Size: 246 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120127/de5b8c48/attachment-0006.bin>
More information about the Gcc-patches
mailing list