diff options
author | Chris Metcalf <cmetcalf@ezchip.com> | 2014-12-22 14:50:26 -0500 |
---|---|---|
committer | Chris Metcalf <cmetcalf@ezchip.com> | 2014-12-22 14:50:26 -0500 |
commit | 0dacd7a3b9401f7eb7160cf79231a4573773c5da (patch) | |
tree | 892983bc4ed9757a26a8c0217671ef6dfea94c0c /sysdeps/tile/tilegx | |
parent | 929011700ce09f2bb4f6f650ae95b6eb68145deb (diff) | |
download | glibc-0dacd7a3b9401f7eb7160cf79231a4573773c5da.tar.gz |
tilegx: remove implicit boolean conversion in strstr.
[BZ #17746]
The __builtin_expect() truncated a uint64_t to a 32-bit long
in ILP32 mode, discarding the high 32 bits, and potentially
missing the NUL terminator that we were searching for with SIMD
operations. Explicitly compare to zero to fix the problem.
Diffstat (limited to 'sysdeps/tile/tilegx')
-rw-r--r-- | sysdeps/tile/tilegx/strstr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/tile/tilegx/strstr.c b/sysdeps/tile/tilegx/strstr.c index d04f12910d..de5adaff91 100644 --- a/sysdeps/tile/tilegx/strstr.c +++ b/sysdeps/tile/tilegx/strstr.c @@ -154,7 +154,7 @@ STRSTR2 (const char *haystack_start, const char *needle) /* Look for a terminating '\0'. */ zero_matches = __insn_v1cmpeqi (v, 0); uint64_t byte1_matches = __insn_v1cmpeq (v, byte1); - if (__builtin_expect (zero_matches, 0)) + if (__builtin_expect (zero_matches != 0, 0)) { /* This is the last vector. Don't worry about matches crossing into the next vector. Shift the second byte |