diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-06-13 23:02:31 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-06-13 23:04:51 +0200 |
commit | 243ea8673f783d5a85df94b09d4ffd4bc6cc97ce (patch) | |
tree | 5f881a57f94dbac78a07cb287692dec51acded78 /gnu | |
parent | 53411dfcd6e696fc4aea11c70d411db5300ac5e2 (diff) | |
download | guix-243ea8673f783d5a85df94b09d4ffd4bc6cc97ce.tar.gz guix-243ea8673f783d5a85df94b09d4ffd4bc6cc97ce.zip |
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.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/patches/gcc-strmov-store-file-names.patch | 12 |
1 files 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 <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; |