]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Follow-up adjustment to earlier fix in Build_Allocate_Deallocate_Proc
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 11 Feb 2024 18:18:46 +0000 (19:18 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 May 2024 07:27:56 +0000 (09:27 +0200)
The deallocation call of the return and secondary stacks no longer matches
the profile built in Exp_Util.Build_Allocate_Deallocate_Proc, so this just
removes the code as unreachable and adds an assertion to that effect.

gcc/ada/

* gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Add an
assertion that this is not a deallocation of the return or secondary
stack and remove subsequent unreachable code.

gcc/ada/gcc-interface/utils2.cc

index fb0ccf592249c9110529a97580561898a759fdeb..64712cb9962be4a48e2744d29ac528f1f1acd9a9 100644 (file)
@@ -2187,15 +2187,16 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type,
        = Etype (Next_Formal (First_Formal (gnat_proc)));
       tree gnu_size_type = gnat_to_gnu_type (gnat_size_type);
 
+      /* Deallocation is not supported for return and secondary stacks.  */
+      gcc_assert (!gnu_obj);
+
       gnu_size = convert (gnu_size_type, gnu_size);
       gnu_align = convert (gnu_size_type, gnu_align);
 
       if (DECL_BUILT_IN_CLASS (gnu_proc) == BUILT_IN_FRONTEND
          && DECL_FE_FUNCTION_CODE (gnu_proc) == BUILT_IN_RETURN_SLOT)
        {
-         /* This must be an allocation of the return stack in a function that
-            returns by invisible reference.  */
-         gcc_assert (!gnu_obj);
+         /* This must be a function that returns by invisible reference.  */
          gcc_assert (current_function_decl
                      && TREE_ADDRESSABLE (TREE_TYPE (current_function_decl)));
          tree gnu_ret_size;
@@ -2221,11 +2222,6 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type,
                                             N_Raise_Program_Error));
        }
 
-      /* The first arg is the address of the object, for a deallocator,
-        then the size.  */
-      else if (gnu_obj)
-       gnu_call = build_call_n_expr (gnu_proc, 2, gnu_obj, gnu_size);
-
       else
        gnu_call = build_call_n_expr (gnu_proc, 2, gnu_size, gnu_align);
     }