[Ada] Fix problem with VMS descriptor and generics

Eric Botcazou ebotcazou@adacore.com
Sat May 3 19:48:00 GMT 2008


The compiler aborts during gimplification because there is a PLACEHOLDER_EXPR 
left in the tree.  The circumstances are quite convoluted: you need a variant 
record + an unaligned component + a generic subprogram + a VMS descriptor.

It turns out that the component is in fact accidentally unaligned, because the 
qualified union is built with default alignment (BITS_PER_UNIT)

          gnu_union_type
            = make_node (unchecked_union ? UNION_TYPE : QUAL_UNION_TYPE);

which causes the component to be made a bitfield, although it need not be.

Fixed by zeroing the alignment of the qualified union upon creating it.  This 
is already done for its fields recursively via the cancel_alignment argument

  if (cancel_alignment)
    TYPE_ALIGN (gnu_record_type) = 0;

Tested on i586-suse-linux, applied on the mainline.


2008-05-03  Eric Botcazou  <ebotcazou@adacore.com>

        * decl.c (components_to_record): Zero the alignment of the qualified
        union built for the variant part upon creating it.


2008-05-03  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/discr6_pkg.ads: New helper.
	* gnat.dg/discr6.adb: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 428 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080503/7c7edbf7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr6_pkg.ads
Type: text/x-adasrc
Size: 311 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080503/7c7edbf7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr6.adb
Type: text/x-adasrc
Size: 621 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080503/7c7edbf7/attachment-0002.bin>


More information about the Gcc-patches mailing list