]> 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)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 6 Jun 2025 08:37:02 +0000 (10:37 +0200)
commitd575c1bc78f0a3b094cdf41542b8db5c7e364e08
treeaea9f019d9068909a1a6ec0998825c927c7e1e8c
parentb449898970a502d31f30334cf0dd630f93d12bd8
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