From: Thomas Schwinge Date: Wed, 23 Sep 2015 14:52:57 +0000 (+0200) Subject: Fix --enable-offload-targets/-foffload handling, pt. 2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a9c238108bf8532990df88c137383b457acb8893;p=gcc.git Fix --enable-offload-targets/-foffload handling, pt. 2 gcc/ * gcc.c (handle_foffload_option): Don't lose the trailing NUL character when appending to offload_targets. From-SVN: r228054 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df71558a7e5..ca894770504 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2015-09-23 Thomas Schwinge + * gcc.c (handle_foffload_option): Don't lose the trailing NUL + character when appending to offload_targets. + * configure.ac (offload_targets, OFFLOAD_TARGETS): Separate offload targets by commas, not colons. * config.in: Regenerate. diff --git a/gcc/gcc.c b/gcc/gcc.c index 78b68e28aa6..ef132d6fece 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3657,10 +3657,9 @@ handle_foffload_option (const char *arg) size_t offload_targets_len = strlen (offload_targets); offload_targets = XRESIZEVEC (char, offload_targets, - offload_targets_len + next - cur + 2); - if (offload_targets_len) - offload_targets[offload_targets_len++] = ':'; - memcpy (offload_targets + offload_targets_len, target, next - cur); + offload_targets_len + 1 + next - cur + 1); + offload_targets[offload_targets_len++] = ':'; + memcpy (offload_targets + offload_targets_len, target, next - cur + 1); } }