]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix internal error on allocator involving interface type
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 11 Feb 2025 11:47:36 +0000 (12:47 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 6 Jun 2025 14:44:45 +0000 (16:44 +0200)
commit855fe3625493e3888df5da12aba945c243ec6650
tree9e930641112a39633edc1bd51d5b0fa9fa64c344
parent649bde867ae0a808b21e837744211339476c8099
ada: Fix internal error on allocator involving interface type

The problem is that an itype duplicated through Duplicate_Subexpr_No_Checks
ends up in a different scope than its source.  It is fixed by adding a new
formal parameter New_Scope to the function and forwarding it in the call to
the New_Copy_Tree function.

gcc/ada/ChangeLog:

* exp_aggr.adb (Expand_Record_Aggregate): Use the named form for the
second actual parameter in the call to Duplicate_Subexpr.
* exp_attr.adb (Expand_Size_Attribute): Likewise.
* exp_ch5.adb (Expand_Assign_Array): Likewise.
(Expand_Assign_Array_Bitfield): Likewise.
(Expand_Assign_Array_Bitfield_Fast): Likewise.
* exp_util.ads (Duplicate_Subexpr): Add New_Scope formal parameter.
(Duplicate_Subexpr_No_Checks): Likewise.
(Duplicate_Subexpr_Move_Checks): Likewise.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Pass Proc_Id as the
actual for New_Scope in the calls to Duplicate_Subexpr_No_Checks.
(Duplicate_Subexpr): Add New_Scope formal parameter and forward it
in the call to New_Copy_Tree.
(Duplicate_Subexpr_No_Checks): Likewise.
(Duplicate_Subexpr_Move_Checks): Likewise.
gcc/ada/exp_aggr.adb
gcc/ada/exp_attr.adb
gcc/ada/exp_ch5.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads