This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Initialize strtok_r's saveptr to NULL
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Sun, 17 Jul 2016 07:13:57 -0400
- Subject: [binutils-gdb] Initialize strtok_r's saveptr to NULL
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT 9bf74fb27dc6e2a9679403d66fe919215e3c2a45 ***
Author: Manish Goregaokar <manish@mozilla.com>
Branch: master
Commit: 9bf74fb27dc6e2a9679403d66fe919215e3c2a45
Initialize strtok_r's saveptr to NULL
Building gdb with --enable-build-with-cxx=no trips on a warning:
../../binutils-gdb/gdb/rust-lang.c:173:15: error: saveptr may be used
uninitialized in this function [-Werror=maybe-uninitialized]
ret.name = concat (TYPE_NAME (type), "::", token, (char *) NULL);
The problem is that gcc doesn't understand that "tail" can never be
NULL in the call to strtok_r:
name = xstrdup (TYPE_FIELD_NAME (type, 0));
cleanup = make_cleanup (xfree, name);
tail = name + strlen (RUST_ENUM_PREFIX);
...
for (token = strtok_r (tail, "$", &saveptr);
Fix this by always initializing saveptr.
2016-06-29 Manish Goregaokar <manish@mozilla.com>
gdb/ChangeLog:
* rust-lang.c (rust_get_disr_info): Initialize saveptr to NULL.