[gcc-7] 219/354: ada-749574.diff: replace work-around with fix and forward it.

Ximin Luo infinity0 at debian.org
Thu Nov 23 15:50:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository gcc-7.

commit 34154ec87c1a8f7cb8a733053253372e4c2dc01f
Author: nicolas <nicolas at 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>
Date:   Sun Jun 18 01:09:48 2017 +0000

    ada-749574.diff: replace work-around with fix and forward it.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/gcccvs/branches/sid/gcc-7@9522 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
---
 debian/changelog               |   1 +
 debian/patches/ada-749574.diff | 126 ++++++++++++++++++++++++++++++++++-------
 2 files changed, 105 insertions(+), 22 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 483282f..4a34bf9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,7 @@ gcc-7 (7.1.0-7) UNRELEASED; urgency=medium
   * Drop debian/relink, never executed and redundant with ada patches.
   * Ada: Drop dpkg-buildflags usage in patches. Closes: #863289.
   * ada: Drop references to obsolete termio-h.diff. Closes: #845159.
+  * ada-749574.diff: replace work-around with fix and forward it.
 
  -- Matthias Klose <doko at debian.org>  Sat, 17 Jun 2017 15:56:17 +0200
 
diff --git a/debian/patches/ada-749574.diff b/debian/patches/ada-749574.diff
index 2c3b943..74daeac 100644
--- a/debian/patches/ada-749574.diff
+++ b/debian/patches/ada-749574.diff
@@ -1,32 +1,114 @@
 From: Ludovic Brenta <lbrenta at debian.org>
-Forwarded: no
+From: Nicolas Boulenguez <nicolas at debian.org>
+Forwarded: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81087
 Bug-Debian: http://bugs.debian.org/749574
-Description: Constraint_Error, range check failed at gnatlink.adb:2195, when called from gnatmake with -D option
+Description: array index out of range in gnatlink
  The procedure gnatlink assumes that the Linker_Options.Table contains access
  values to strings whose 'First index is always 1.  This assumption is wrong
  for the string returned by function Base_Name.
-.
- Instead of fixing the assumption in many places, this patch changes the
- function Base_Name always to return a string with 'First=1.
-.
- This looks like an upstream bug but strangely the reporter of this bug
- says it does not happen on GCC built from upstream sources.  Further
- investigation is required to determine whether or not to forward this
- bug and patch upstream.
+ .
+ The wrong indices are not detected because gnatlink is compiled with
+ -gnatp, but the test result is wrong.
+ .
+ The following program normally raises Constraint_Error, prints FALSE
+ if compiled with -gnatn, while the expected result is TRUE.
+ .
+ procedure A is
+    G : constant String (3 .. 5) := "abc";
+ begin
+    Ada.Text_IO.Put_Line (Boolean'Image (G (1 .. 2) = "ab"));
+ end A;
 
 --- a/src/gcc/ada/gnatlink.adb
 +++ b/src/gcc/ada/gnatlink.adb
-@@ -269,7 +269,12 @@
-          Findex2 := File_Name'Last + 1;
-       end if;
+@@ -238,6 +238,9 @@
+    procedure Write_Usage;
+    --  Show user the program options
  
--      return File_Name (Findex1 .. Findex2 - 1);
-+      declare
-+         Result : String (1 .. Findex2 - Findex1);
-+      begin
-+         Result (1 .. Findex2 - Findex1) := File_Name (Findex1 .. Findex2 - 1);
-+         return Result;
-+      end;
-    end Base_Name;
++   function Starts_With (Source, Pattern : String) return Boolean;
++   pragma Inline (Starts_With);
++
+    ---------------
+    -- Base_Name --
+    ---------------
+@@ -524,7 +527,7 @@
+                   Binder_Options.Table (Binder_Options.Last) :=
+                     Linker_Options.Table (Linker_Options.Last);
  
-    -------------------------------
+-               elsif Arg'Length >= 7 and then Arg (1 .. 7) = "--LINK=" then
++               elsif Starts_With (Arg, "--LINK=") then
+                   if Arg'Length = 7 then
+                      Exit_With_Error ("Missing argument for --LINK=");
+                   end if;
+@@ -537,7 +540,7 @@
+                        ("Could not locate linker: " & Arg (8 .. Arg'Last));
+                   end if;
+ 
+-               elsif Arg'Length > 6 and then Arg (1 .. 6) = "--GCC=" then
++               elsif Starts_With (Arg, "--GCC=") then
+                   declare
+                      Program_Args : constant Argument_List_Access :=
+                                       Argument_String_To_List
+@@ -1258,13 +1261,9 @@
+                                          1 .. Linker_Options.Last
+                                        loop
+                                           if Linker_Options.Table (J) /= null
+-                                            and then
+-                                              Linker_Options.Table (J)'Length
+-                                                        > Run_Path_Opt'Length
+-                                            and then
+-                                              Linker_Options.Table (J)
+-                                                (1 .. Run_Path_Opt'Length) =
+-                                                                 Run_Path_Opt
++                                            and then Starts_With
++                                            (Linker_Options.Table (J).all,
++                                             Run_Path_Opt)
+                                           then
+                                              --  We have found an already
+                                              --  specified run_path_option:
+@@ -1381,6 +1380,17 @@
+       Status := fclose (Fd);
+    end Process_Binder_File;
+ 
++   ----------------
++   -- StartsWith --
++   ----------------
++
++   function Starts_With (Source, Pattern : String) return Boolean is
++      Last : constant Natural := Source'First + Pattern'Length - 1;
++   begin
++      return Last <= Source'Last
++        and then Pattern = Source (Source'First .. Last);
++   end Starts_With;
++
+    -----------
+    -- Usage --
+    -----------
+@@ -1894,8 +1904,8 @@
+          while J <= Linker_Options.Last loop
+             if Linker_Options.Table (J).all = "-Xlinker"
+               and then J < Linker_Options.Last
+-              and then Linker_Options.Table (J + 1)'Length > 8
+-              and then Linker_Options.Table (J + 1) (1 .. 8) = "--stack="
++              and then Starts_With (Linker_Options.Table (J + 1).all,
++                                    "--stack=")
+             then
+                if Stack_Op then
+                   Linker_Options.Table (J .. Linker_Options.Last - 2) :=
+@@ -1926,13 +1935,9 @@
+             --  Here we just check for a canonical form that matches the
+             --  pragma Linker_Options set in the NT runtime.
+ 
+-            if (Linker_Options.Table (J)'Length > 17
+-                and then Linker_Options.Table (J) (1 .. 17) =
+-                  "-Xlinker --stack=")
+-              or else
+-                (Linker_Options.Table (J)'Length > 12
+-                 and then Linker_Options.Table (J) (1 .. 12) =
+-                       "-Wl,--stack=")
++            if Starts_With (Linker_Options.Table (J).all, "-Xlinker --stack=")
++              or else Starts_With (Linker_Options.Table (J).all,
++                                   "-Wl,--stack=")
+             then
+                if Stack_Op then
+                   Linker_Options.Table (J .. Linker_Options.Last - 1) :=

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gcc-7.git



More information about the Reproducible-commits mailing list