From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 523 invoked by alias); 13 Nov 2014 18:22:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 455 invoked by uid 48); 13 Nov 2014 18:22:27 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/63853] [5.0 Regression] The use of strchrnul breaks bootstrap on x86_64-apple-darwin14. Date: Thu, 13 Nov 2014 18:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01154.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63853 --- Comment #9 from Dominique d'Humieres --- I just completed a clean bootstrap of r217511 with the following patch --- ../_clean/gcc/gcc.c 2014-11-13 15:29:00.000000000 +0100 +++ gcc/gcc.c 2014-11-13 17:59:47.000000000 +0100 @@ -3375,12 +3375,16 @@ handle_foffload_option (const char *arg) if (arg[0] == '-') return; - end = strchrnul (arg, '='); + end = strchr (arg, '='); + if (end == NULL) + end = strchr (arg, '\0'); cur = arg; while (cur < end) { - next = strchrnul (cur, ','); + next = strchr (cur, ','); + if (next == NULL) + next = strchr (cur, '\0'); next = (next > end) ? end : next; target = XNEWVEC (char, next - cur + 1); @@ -3400,7 +3404,9 @@ handle_foffload_option (const char *arg) c = OFFLOAD_TARGETS; while (c) { - n = strchrnul (c, ','); + n = strchr (c, ','); + if (n == NULL) + n = strchr (c, '\0'); if (strlen (target) == (size_t) (n - c) && strncmp (target, c, n - c) == 0) @@ -3421,7 +3427,9 @@ handle_foffload_option (const char *arg) c = offload_targets; do { - n = strchrnul (c, ':'); + n = strchr (c, ':'); + if (n == NULL) + n = strchr (c, '\0'); if (strlen (target) == (size_t) (n - c) && strncmp (c, target, n - c) == 0) --- ../_clean/gcc/lto-wrapper.c 2014-11-13 15:29:00.000000000 +0100 +++ gcc/lto-wrapper.c 2014-11-13 17:54:48.000000000 +0100 @@ -424,7 +424,9 @@ parse_env_var (const char *str, char *** values = (char**) xmalloc (num * sizeof (char*)); curval = str; - nextval = strchrnul (curval, ':'); + nextval = strchr (curval, ':'); + if (nextval == NULL) + nextval = strchr (curval, '\0'); int append_len = append ? strlen (append) : 0; for (i = 0; i < num; i++) @@ -436,7 +438,9 @@ parse_env_var (const char *str, char *** if (append) strcat (values[i], append); curval = nextval + 1; - nextval = strchrnul (curval, ':'); + nextval = strchr (curval, ':'); + if (nextval == NULL) + nextval = strchr (curval, '\0'); } *pvalues = values; return num; @@ -581,7 +585,9 @@ append_offload_options (obstack *argv_ob while (cur < opts) { - next = strchrnul (cur, ','); + next = strchr (cur, ','); + if (next == NULL) + next = strchr (cur, '\0'); next = (next > opts) ? opts : next; if (strlen (target) == (size_t) (next - cur)