aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adadecode.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-07-04 23:35:01 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-08-02 09:08:03 +0200
commit058e5fd2bd1f18e2c1b6bd1fc02e77560d99f8e8 (patch)
tree874a6de386c4d1640920e20a71762e38470392ba /gcc/ada/adadecode.c
parent99337cb2385c38182e48a491442da449c028f51c (diff)
downloadgcc-058e5fd2bd1f18e2c1b6bd1fc02e77560d99f8e8.zip
gcc-058e5fd2bd1f18e2c1b6bd1fc02e77560d99f8e8.tar.gz
gcc-058e5fd2bd1f18e2c1b6bd1fc02e77560d99f8e8.tar.bz2
ada: Fix crash on expression function returning tagged type in nested package
This happens when the expression is a reference to a formal parameter of the function, or a conditional expression with such a reference as one of its dependent expressions, because the RM 6.5(8/5) subclause prescribes a tag reassignment in this case, which requires freezing the tagged type in the GNAT freezing model, although the language says there is no freezing. In other words, it's another occurrence of the discrepancy between this model tailored to Ada 95 and the freezing rules introduced in Ada 2012, that is papered over by Should_Freeze_Type and the associated processing. gcc/ada/ * exp_util.ads (Is_Conversion_Or_Reference_To_Formal): New function declaration. * exp_util.adb (Is_Conversion_Or_Reference_To_Formal): New function body. * exp_ch6.adb (Expand_Simple_Function_Return): Call the predicate Is_Conversion_Or_Reference_To_Formal in order to decide whether a tag check or reassignment is needed. * freeze.adb (Should_Freeze_Type): Move declaration and body to the appropriate places. Also return True for tagged results subject to the expansion done in Expand_Simple_Function_Return that is guarded by the predicate Is_Conversion_Or_Reference_To_Formal.
Diffstat (limited to 'gcc/ada/adadecode.c')
0 files changed, 0 insertions, 0 deletions