diff mbox series

tcg: Fix out-of-line generic vector compares

Message ID 20180406010015.16979-1-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Fix out-of-line generic vector compares | expand

Commit Message

Richard Henderson April 6, 2018, 1 a.m. UTC
A mistake in the type passed to sizeof, that happens to work
when the out-of-line fallback itself is using host vectors,
but fails when using only the base types.

Reported-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 accel/tcg/tcg-runtime-gvec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.14.3

Comments

Emilio Cota April 6, 2018, 2:23 a.m. UTC | #1
On Fri, Apr 06, 2018 at 11:00:15 +1000, Richard Henderson wrote:
> A mistake in the type passed to sizeof, that happens to work

> when the out-of-line fallback itself is using host vectors,

> but fails when using only the base types.

> 

> Reported-by: Emilio G. Cota <cota@braap.org>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Tested-by: Emilio G. Cota <cota@braap.org>


Thanks!

		Emilio
diff mbox series

Patch

diff --git a/accel/tcg/tcg-runtime-gvec.c b/accel/tcg/tcg-runtime-gvec.c
index 8bf8d63912..90340e56e0 100644
--- a/accel/tcg/tcg-runtime-gvec.c
+++ b/accel/tcg/tcg-runtime-gvec.c
@@ -705,7 +705,7 @@  void HELPER(NAME)(void *d, void *a, void *b, uint32_t desc)                \
 {                                                                          \
     intptr_t oprsz = simd_oprsz(desc);                                     \
     intptr_t i;                                                            \
-    for (i = 0; i < oprsz; i += sizeof(vec64)) {                           \
+    for (i = 0; i < oprsz; i += sizeof(TYPE)) {                            \
         *(TYPE *)(d + i) = DO_CMP0(*(TYPE *)(a + i) OP *(TYPE *)(b + i));  \
     }                                                                      \
     clear_high(d, oprsz, desc);                                            \