]> git.ipfire.org Git - thirdparty/gcc.git/commit
Ada: Fix internal error on access attribute used as subpool in allocator
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Feb 2026 10:38:24 +0000 (11:38 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Feb 2026 11:07:47 +0000 (12:07 +0100)
commitf474ff7fc758482bb5222d989a7ff6ffd079b4a6
tree09804c1ccc732e32cd0cf8b084ded1473ae80f21
parent7a4b0cec47e4a3c0466c9f8ea89e66c9b8f39e85
Ada: Fix internal error on access attribute used as subpool in allocator

This is a regression present for quite a long time: the compiler aborts
on an allocator whose subpool name is an access attribute and when an
allocation procedure must be generated, for example when the allocation
is controlled.

The fix is to do what is done elsewhere in Build_Allocate_Deallocate_Proc,
that is to say pass the allocation procedure as the new scope in the call
to the New_Copy_Tree function.

gcc/ada/
PR ada/124054
* exp_util.adb (Build_Allocate_Deallocate_Proc): Tidy up and pass
Proc_Id as the new scope in the call to the New_Copy_Tree function.

gcc/testsuite/
* gnat.dg/allocator4.adb: New test.

Co-authored-by: Liam Powell <liam@liampwll.com>
gcc/ada/exp_util.adb
gcc/testsuite/gnat.dg/allocator4.adb [new file with mode: 0644]