aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2024-07-30 13:48:39 -0700
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-08-08 16:28:29 +0200
commit480819c921ed656ace16c5359aaa2d9abdc73ba5 (patch)
tree209e3b923d66c7ee2c8db3bb107d26de591a5834 /gcc/ada/exp_ch4.adb
parent85f2ffd80ed7a54f36a9bb3a91ee07b2d5e23970 (diff)
downloadgcc-480819c921ed656ace16c5359aaa2d9abdc73ba5.zip
gcc-480819c921ed656ace16c5359aaa2d9abdc73ba5.tar.gz
gcc-480819c921ed656ace16c5359aaa2d9abdc73ba5.tar.bz2
ada: Etype missing for raise expression
If the primitive equality operator of the component type of an array type is abstract, then a call to that abstract function raises Program_Error (when such a call is legal). The FE generates a raise expression to implement this. That raise expression is an expression so it should have a valid Etype. gcc/ada/ * exp_ch4.adb (Build_Eq_Call): In the abstract callee case, copy the Etype of the callee onto the Make_Raise_Program_Error result.
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 18ec712..106305f 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -443,8 +443,11 @@ package body Exp_Ch4 is
begin
if Present (Eq) then
if Is_Abstract_Subprogram (Eq) then
- return Make_Raise_Program_Error (Loc,
- Reason => PE_Explicit_Raise);
+ return Result : constant Node_Id :=
+ Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise)
+ do
+ Set_Etype (Result, Etype (Eq));
+ end return;
else
return