]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix for Default_Component_Value with declare expressions
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 16 May 2024 08:59:31 +0000 (10:59 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 21 Jun 2024 08:34:18 +0000 (10:34 +0200)
commita0546a36e007d1def02f5a575d1b4e2a08a66115
tree4960faefb85bb3c0864f5ca63bc206a723913ad1
parent3ebd803b861e1da85f08664915e3267f690ff611
ada: Fix for Default_Component_Value with declare expressions

When the expression of aspect Default_Component_Value includes a declare
expression with current type instance, we attempted to recursively froze
that type, which itself caused an infinite recursion, because we didn't
properly manage the scope of declare expression.

This patch fixes both the detection of the current type instance and
analysis of the expression that caused recursive freezing.

gcc/ada/

* sem_attr.adb (In_Aspect_Specification): Use the standard
condition that works correctly with declare expressions.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Replace
ordinary analysis with preanalysis of spec expressions.
gcc/ada/sem_attr.adb
gcc/ada/sem_ch13.adb