From 243ea8673f783d5a85df94b09d4ffd4bc6cc97ce Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Jun 2018 23:02:31 +0200 Subject: gnu: gcc: Fix 'gcc-strmov-store-file-names.patch'. Fixes . Previously GCC would crash when encountering a 'static const' element without an initializer, as in: #define _GNU_SOURCE #include 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 9f9162855d..7358de3326 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 . --- 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 . + 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 . */ -+ str = DECL_INITIAL (str); ++ { ++ /* STR may be a 'static const' variable whose initial value ++ is a string constant. See . */ ++ str = DECL_INITIAL (str); ++ if (str == NULL_TREE) ++ return false; ++ } + + if (TREE_CODE (str) != STRING_CST) + return false; -- cgit v1.2.3