civodul pushed a commit to branch core-updates
in repository guix.

commit 243ea8673f783d5a85df94b09d4ffd4bc6cc97ce
Author: Ludovic Courtès <l...@gnu.org>
Date:   Wed Jun 13 23:02:31 2018 +0200

    gnu: gcc: Fix 'gcc-strmov-store-file-names.patch'.
    
    Fixes <https://bugs.gnu.org/31708>.
    
    Previously GCC would crash when encountering a 'static const' element
    without an initializer, as in:
    
      #define _GNU_SOURCE
      #include <string.h>
    
      void foo (char *x)
      {
        static const char buf[12];
        memcpy (x, buf, 12);
      }
    
    * gnu/packages/patches/gcc-strmov-store-file-names.patch: Return false
    when DECL_INITIAL returns NULL_TREE.
---
 gnu/packages/patches/gcc-strmov-store-file-names.patch | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/patches/gcc-strmov-store-file-names.patch 
b/gnu/packages/patches/gcc-strmov-store-file-names.patch
index 9f91628..7358de3 100644
--- a/gnu/packages/patches/gcc-strmov-store-file-names.patch
+++ b/gnu/packages/patches/gcc-strmov-store-file-names.patch
@@ -15,7 +15,7 @@ and <https://bugs.gnu.org/30395>.
 
 --- gcc-5.3.0/gcc/builtins.c   2016-10-18 10:50:46.080616285 +0200
 +++ gcc-5.3.0/gcc/builtins.c   2016-11-09 15:26:43.693042737 +0100
-@@ -3192,6 +3192,54 @@ determine_block_size (tree len, rtx len_
+@@ -3192,6 +3192,58 @@ determine_block_size (tree len, rtx len_
                          GET_MODE_MASK (GET_MODE (len_rtx)));
  }
  
@@ -35,9 +35,13 @@ and <https://bugs.gnu.org/30395>.
 +  if (TREE_CODE (str) == VAR_DECL
 +      && TREE_STATIC (str)
 +      && TREE_READONLY (str))
-+    /* STR may be a 'static const' variable whose initial value
-+       is a string constant.  See <https://bugs.gnu.org/30395>.  */
-+    str = DECL_INITIAL (str);
++    {
++      /* STR may be a 'static const' variable whose initial value
++         is a string constant.  See <https://bugs.gnu.org/30395>.  */
++      str = DECL_INITIAL (str);
++      if (str == NULL_TREE)
++        return false;
++    }
 +
 +  if (TREE_CODE (str) != STRING_CST)
 +    return false;

Reply via email to