[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] target/hexagon: fix = vs. == mishap
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2] target/hexagon: fix = vs. == mishap |
Date: |
Sat, 29 Apr 2023 10:27:16 +0100 |
On Fri, 28 Apr 2023 at 21:45, Taylor Simpson <tsimpson@quicinc.com> wrote:
>
> From: Paolo Bonzini <pbonzini@redhat.com>
>
> **** Changes in v2 ****
> Fix yyassert's for sign and zero extends
>
> Coverity reports a parameter that is "set but never used". This is caused
> by an assignment operator being used instead of equality.
The commit message says it's fixing yyasserts, but the
new changed code doesn't seem to be fixing yyasserts?
> Co-authored-by: Taylor Simpson <tsimpson@quicinc.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
> ---
> target/hexagon/idef-parser/parser-helpers.c | 2 +-
> target/hexagon/idef-parser/idef-parser.y | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/target/hexagon/idef-parser/parser-helpers.c
> b/target/hexagon/idef-parser/parser-helpers.c
> index 86511efb62..0a01ec39b7 100644
> --- a/target/hexagon/idef-parser/parser-helpers.c
> +++ b/target/hexagon/idef-parser/parser-helpers.c
> @@ -1123,7 +1123,7 @@ HexValue gen_extend_op(Context *c,
> HexValue *value,
> HexSignedness signedness)
> {
> - unsigned bit_width = (dst_width = 64) ? 64 : 32;
> + unsigned bit_width = (dst_width == 64) ? 64 : 32;
> HexValue value_m = *value;
> HexValue src_width_m = *src_width;
>
> diff --git a/target/hexagon/idef-parser/idef-parser.y
> b/target/hexagon/idef-parser/idef-parser.y
> index 5444fd4749..2561f0ebb0 100644
> --- a/target/hexagon/idef-parser/idef-parser.y
> +++ b/target/hexagon/idef-parser/idef-parser.y
> @@ -685,7 +685,7 @@ rvalue : FAIL
> yyassert(c, &@1, $5.type == IMMEDIATE &&
> $5.imm.type == VALUE,
> "SXT expects immediate values\n");
> - $$ = gen_extend_op(c, &@1, &$3, $5.imm.value, &$7, SIGNED);
> + $$ = gen_extend_op(c, &@1, &$3, 64, &$7, SIGNED);
> }
> | ZXT '(' rvalue ',' IMM ',' rvalue ')'
> {
> @@ -693,7 +693,7 @@ rvalue : FAIL
> yyassert(c, &@1, $5.type == IMMEDIATE &&
> $5.imm.type == VALUE,
> "ZXT expects immediate values\n");
> - $$ = gen_extend_op(c, &@1, &$3, $5.imm.value, &$7, UNSIGNED);
> + $$ = gen_extend_op(c, &@1, &$3, 64, &$7, UNSIGNED);
> }
> | '(' rvalue ')'
> {
> --
> 2.25.1
thanks
-- PMM