diff options
author | Javier Miranda <miranda@adacore.com> | 2024-09-17 11:53:06 +0000 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-10-25 11:09:00 +0200 |
commit | 2325d653e3790f3ffda9aebf7f7a94f7aacd0bc0 (patch) | |
tree | be089c595984980945322923d798dba35303f507 /gcc/ada/sem_ch4.adb | |
parent | c2673f56cc13208ee401a4feda690a0e377d55c7 (diff) | |
download | gcc-2325d653e3790f3ffda9aebf7f7a94f7aacd0bc0.zip gcc-2325d653e3790f3ffda9aebf7f7a94f7aacd0bc0.tar.gz gcc-2325d653e3790f3ffda9aebf7f7a94f7aacd0bc0.tar.bz2 |
ada: Constraint error not raised in ACATS test c413007
The Constraint_Error exception is not raised when a subprogram
is called using prefix notation, and the prefix of the call is
an access-to-subprogram type with a null value. This new check
is enabled by switch -gnatd_P
gcc/ada/ChangeLog:
* gen_il-fields.ads: New node field (Is_Expanded_Prefixed_Call).
* gen_il-gen-gen_nodes.adb: New semantic field for N_Function_Call
and N_Procedure_Call_Statement nodes.
* sem_ch4.adb (Complete_Object_Operation): Mark the rewritten node
with the Is_Expanded_Prefixed_Call flag.
* sem_res.adb (Check_Prefixed_Call): Code cleanup and addition of
documentation.
(Resolve_Actuals): Add a null-exclusion check on the
prefix of the call when it is an access-type.
* sinfo.ads: Adding new semantic flag (Is_Expanded_Prefixed_Call)
to N_Function_Call and N_Procedure_Call_Statement nodes.
* debug.adb: Adding documentation for switch d_P.
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index bf0d7cf..c1f6622 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -9510,7 +9510,6 @@ package body Sem_Ch4 is Error_Msg_NE ("expect variable in call to&", Prefix (N), Entity (Subprog)); end if; - -- Conversely, if the formal is an access parameter and the object is -- not an access type or a reference type (i.e. a type with the -- Implicit_Dereference aspect specified), replace the actual with a @@ -9581,6 +9580,8 @@ package body Sem_Ch4 is Rewrite (Node_To_Replace, Call_Node); + Set_Is_Expanded_Prefixed_Call (Node_To_Replace); + -- Propagate the interpretations collected in subprog to the new -- function call node, to be resolved from context. @@ -10746,6 +10747,7 @@ package body Sem_Ch4 is Complete_Object_Operation (Call_Node => New_Call_Node, Node_To_Replace => Node_To_Replace); + return True; end if; |