]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Constraint error not raised in ACATS test c413007
authorJavier Miranda <miranda@adacore.com>
Sun, 20 Oct 2024 12:13:03 +0000 (12:13 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 18 Nov 2024 14:06:54 +0000 (15:06 +0100)
Reverse the meaning of switch -gnatd_P; that is, enable by default
the generating of a runtime check when the prefix of the call is
an access-to-subprogram type with a null value.

gcc/ada/ChangeLog:

* sem_res.adb (Resolve_Actuals): Add by default a null-exclusion
check on the prefix of the call when it is an access-type; it can
be disabled using -gnatd_P.
* debug.adb (gnatd_P): Update documentation.

gcc/ada/debug.adb
gcc/ada/sem_res.adb

index 9daa0110233bc2d0cc411aae64f86a06a7a79aea..2d0c32b0f094164675cd0a29f1a0a46c0d321877 100644 (file)
@@ -180,7 +180,7 @@ package body Debug is
    --  d_M  Ignore Source_File_Name and Source_File_Name_Project pragmas
    --  d_N
    --  d_O
-   --  d_P  Enable runtime check for null prefix of prefixed subprogram call
+   --  d_P  Disable runtime check for null prefix of prefixed subprogram call
    --  d_Q
    --  d_R  For LLVM, dump the representation of records
    --  d_S
@@ -1040,13 +1040,14 @@ package body Debug is
    --       it is checked, and the progress of the recursive trace through
    --       elaboration calls at compile time.
 
-   --  d_P  For prefixed subprogram calls with an access-type prefix, generate
-   --       a null-excluding runtime check on the prefix, even when the called
-   --       subprogram has a first access parameter that does not exclude null
-   --       (that is the case only for class-wide parameter, as controlling
-   --       parameters are automatically null-excluding). In such a case,
-   --       P.Proc is equivalent to Proc(P.all'Access); see RM 6.4(9.1/5).
-   --       This includes a dereference, and thus a null check.
+   --  d_P  For prefixed subprogram calls with an access-type prefix, disable
+   --       the generation of a null-excluding runtime check on the prefix,
+   --       even when the called subprogram has a first access parameter that
+   --       does not exclude null (that is the case only for class-wide
+   --       parameter, as controlling parameters are automatically null-
+   --       excluding). In such a case, P.Proc is equivalent to the call
+   --       Proc(P.all'Access); see RM 6.4(9.1/5). This includes a dereference,
+   --       and thus a null check.
 
    --  d_R  In the LLVM backend, output the internal representation of
    --       each record
index d2b019aef173bd549189d89684f26f1105812605..2d0e2be18497a0dc384f2e23b28c7c1531b0a6f3 100644 (file)
@@ -4942,7 +4942,7 @@ package body Sem_Res is
                        A, Nam);
                   end if;
 
-                  if Debug_Flag_Underscore_PP
+                  if not Debug_Flag_Underscore_PP
                     and then
                       (Is_Controlling_Formal (F)
                          or else Is_Class_Wide_Type (Designated_Type (F_Typ)))