aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-05-28 13:03:19 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-21 10:34:23 +0200
commitfbe4dd20b9f25eaa0b6b90d008aff4708e47765b (patch)
treedb9fdec49acf1471cd62a1f14ed537dfb00b102d /gcc
parent2b510ac3aa521c6984495c63547914f271f1f51c (diff)
downloadgcc-fbe4dd20b9f25eaa0b6b90d008aff4708e47765b.zip
gcc-fbe4dd20b9f25eaa0b6b90d008aff4708e47765b.tar.gz
gcc-fbe4dd20b9f25eaa0b6b90d008aff4708e47765b.tar.bz2
ada: Fix internal error on protected type with -gnatc -gnatR
It occurs when the body of a protected subprogram is processed, because the references to the components of the type have not been properly expanded. gcc/ada/ * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Also return early for a protected subprogram in -gnatc mode.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/trans.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index 83ed17b..3f2eadd 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -3934,6 +3934,12 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
if (Is_Generic_Subprogram (gnat_subprog) || Is_Eliminated (gnat_subprog))
return;
+ /* Likewise if this is a protected subprogram and we are only annotating
+ types, as the required expansion of references did not take place. */
+ if (Convention (gnat_subprog) == Convention_Protected
+ && type_annotate_only)
+ return;
+
/* If this subprogram acts as its own spec, define it. Otherwise, just get
the already-elaborated tree node. However, if this subprogram had its
elaboration deferred, we will already have made a tree node for it. So