public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Ronan Desplanques <desplanques@adacore.com>
Subject: [COMMITTED 4/7] ada: Fix array-manipulating code in Mdll
Date: Thu, 27 Jun 2024 10:52:27 +0200	[thread overview]
Message-ID: <20240627085232.226541-4-poulhies@adacore.com> (raw)
In-Reply-To: <20240627085232.226541-1-poulhies@adacore.com>

From: Ronan Desplanques <desplanques@adacore.com>

This patch fixes a duo of array assigments in Mdll that were bound
to fail.

gcc/ada/

	* mdll.adb (Build_Non_Reloc_DLL): Fix incorrect assignment
	to array object.
	(Ada_Build_Non_Reloc_DLL): Likewise.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/mdll.adb | 43 ++++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/gcc/ada/mdll.adb b/gcc/ada/mdll.adb
index 2f946b0a5bb..ac4af8363aa 100644
--- a/gcc/ada/mdll.adb
+++ b/gcc/ada/mdll.adb
@@ -322,17 +322,21 @@ package body MDLL is
          --  Build the DLL
 
          declare
-            Params : OS_Lib.Argument_List :=
-                       Adr_Opt'Unchecked_Access & All_Options;
+            Params      : constant OS_Lib.Argument_List :=
+                            Map_Opt'Unchecked_Access &
+                            Adr_Opt'Unchecked_Access & All_Options;
+            First_Param : Positive := Params'First + 1;
+
          begin
             if Map_File then
-               Params := Map_Opt'Unchecked_Access & Params;
+               First_Param := Params'First;
             end if;
 
-            Utl.Gcc (Output_File => Dll_File,
-                     Files       => Exp_File'Unchecked_Access & Ofiles,
-                     Options     => Params,
-                     Build_Lib   => True);
+            Utl.Gcc
+              (Output_File => Dll_File,
+               Files       => Exp_File'Unchecked_Access & Ofiles,
+               Options     => Params (First_Param .. Params'Last),
+               Build_Lib   => True);
          end;
 
          OS_Lib.Delete_File (Exp_File, Success);
@@ -377,20 +381,25 @@ package body MDLL is
          Utl.Gnatbind (L_Afiles, Options & Bargs_Options);
 
          declare
-            Params : OS_Lib.Argument_List :=
-                       Out_Opt'Unchecked_Access &
-                       Dll_File'Unchecked_Access &
-                       Lib_Opt'Unchecked_Access &
-                       Exp_File'Unchecked_Access &
-                       Adr_Opt'Unchecked_Access &
-                       Ofiles &
-                       All_Options;
+            Params      : constant OS_Lib.Argument_List :=
+                            Map_Opt'Unchecked_Access &
+                            Out_Opt'Unchecked_Access &
+                            Dll_File'Unchecked_Access &
+                            Lib_Opt'Unchecked_Access &
+                            Exp_File'Unchecked_Access &
+                            Adr_Opt'Unchecked_Access &
+                            Ofiles &
+                            All_Options;
+            First_Param : Positive := Params'First + 1;
+
          begin
             if Map_File then
-               Params := Map_Opt'Unchecked_Access & Params;
+               First_Param := Params'First;
             end if;
 
-            Utl.Gnatlink (L_Afiles (L_Afiles'Last).all, Params);
+            Utl.Gnatlink
+              (L_Afiles (L_Afiles'Last).all,
+               Params (First_Param .. Params'Last));
          end;
 
          OS_Lib.Delete_File (Exp_File, Success);
-- 
2.45.2


  parent reply	other threads:[~2024-06-27  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27  8:52 [COMMITTED 1/7] ada: Implement first half of Generalized Finalization Marc Poulhiès
2024-06-27  8:52 ` [COMMITTED 2/7] ada: Overridden operation field not correctly set for controlling result wrappers Marc Poulhiès
2024-06-27  8:52 ` [COMMITTED 3/7] ada: Bug using user defined string literals with interpolated strings Marc Poulhiès
2024-06-27  8:52 ` Marc Poulhiès [this message]
2024-06-27  8:52 ` [COMMITTED 5/7] ada: Add missing dimension information for target names Marc Poulhiès
2024-06-27  8:52 ` [COMMITTED 6/7] ada: Reject ambiguous function calls in interpolated string expressions Marc Poulhiès
2024-06-27  8:52 ` [COMMITTED 7/7] ada: Remove last uses of System.Address_Operations in runtime library Marc Poulhiès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240627085232.226541-4-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=desplanques@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).