From 0dacd7a3b9401f7eb7160cf79231a4573773c5da Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Mon, 22 Dec 2014 14:50:26 -0500 Subject: 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. --- sysdeps/tile/tilegx/strstr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/tile') 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 -- cgit v1.2.3