[Bug ada/124285] [13/14/15/16 regression] infinite recursion on unchecked union type with representation clause

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 28 18:53:45 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124285

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:1011a57e0b42bd4c0b1c3bcc21e7adc121b2ca72

commit r16-7826-g1011a57e0b42bd4c0b1c3bcc21e7adc121b2ca72
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Sat Feb 28 19:48:23 2026 +0100

    Ada: Fix infinite recursion on unchecked union with representation clause

    This is a regression present on all active branches: the compiler enters an
    infinite recursion when it is generating the initialization procedure of an
    unchecked union type with a representation clause, because the layout it
has
    done for it is problematic.  This comes from an old kludge added to support
    aggregates for such types, so the fix is to further tweak this kludge.

    gcc/ada/
            PR ada/124285
            * gcc-interface/decl.cc (components_to_record): Force a packed
            layout for the innermost variant of an unchecked union type with
            fixed part and full representation clause.

    gcc/testsuite/
            * gnat.dg/specs/unchecked_union3.ads: New test.


More information about the Gcc-bugs mailing list