[Bug ada/124016] Bounded_Indefinite_Holders cause integer overflow error with class-wide types or large array types

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 12 17:32:54 GMT 2026


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

--- Comment #8 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:ec93f25c4b0fa3d17928d576157cdfac9985459e

commit r16-8051-gec93f25c4b0fa3d17928d576157cdfac9985459e
Author: Steve Baird <baird@adacore.com>
Date:   Thu Mar 12 18:18:36 2026 +0100

    Ada: Fix Program_Error raised in a Bounded_Indefinite_Holders instance

    If Ada.Containers.Bounded_Indefinite_Holders is instantiated with an
    Element_Type that requires finalization, the declaration of a Holder
    object with an explicit initial value may incorrectly raise Program_Error
    during its elaboration.

    gcc/ada/
            PR ada/124016
            * libgnat/a-cbinho.adb (Create_Subpool): Handle the case where
            the type Holder_Subpool has nontrivial finalization. Declare the
            local variable Subpool with its Import aspect specified (to avoid
            unwanted finalization), and make corresponding changes in order to
            initialize that variable.
            * libgnat/s-stposu.ads (_Adjust_Clone): New procedure.
            * libgnat/s-stposu.adb (_Adjust_Clone): New body.


More information about the Gcc-bugs mailing list