Richard Henderson <richard.hender...@linaro.org> writes:

> 'I' was being double-incremented; correctly within the inner loop
> and incorrectly within the outer loop.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>

Reviewed-by: Alex Bennée <alex.ben...@linaro.org>
Tested-by: Alex Bennée <alex.ben...@linaro.org>

> ---
>
> Fixes a SIGSEGV within one of these generated helpers,
> exposed by an armclang vectorized code sample.
>
>
> r~
>
> ---
>  target/arm/sve_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
> index cec0d3ee54..ddc592ff79 100644
> --- a/target/arm/sve_helper.c
> +++ b/target/arm/sve_helper.c
> @@ -4855,7 +4855,7 @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, 
> void *vm,       \
>      intptr_t i, oprsz = simd_oprsz(desc);                               \
>      unsigned scale = simd_data(desc);                                   \
>      uintptr_t ra = GETPC();                                             \
> -    for (i = 0; i < oprsz; i++) {                                       \
> +    for (i = 0; i < oprsz; ) {                                          \
>          uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3));                 \
>          do {                                                            \
>              TYPEM m = 0;                                                \
> @@ -4936,7 +4936,7 @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, 
> void *vm,       \
>      uintptr_t ra = GETPC();                                             \
>      bool first = true;                                                  \
>      mmap_lock();                                                        \
> -    for (i = 0; i < oprsz; i++) {                                       \
> +    for (i = 0; i < oprsz; ) {                                          \
>          uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3));                 \
>          do {                                                            \
>              TYPEM m = 0;                                                \


--
Alex Bennée

Reply via email to