[Qemu-devel] [PATCH] decodetree: Fix comparison of Field

Richard Henderson posted 1 patch 4 years, 10 months ago
Test asan passed
Test docker-mingw@fedora passed
Test checkpatch passed
Test s390x passed
Test docker-clang@ubuntu passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190604154225.26992-1-richard.henderson@linaro.org
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Cleber Rosa <crosa@redhat.com>, Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>
scripts/decodetree.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] decodetree: Fix comparison of Field
Posted by Richard Henderson 4 years, 10 months ago
Typo comparing the sign of the field, twice, instead of also comparing
the mask of the field (which itself encodes both position and length).

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 scripts/decodetree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 81874e22cc..d7a59d63ac 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -184,7 +184,7 @@ class Field:
         return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
 
     def __eq__(self, other):
-        return self.sign == other.sign and self.sign == other.sign
+        return self.sign == other.sign and self.mask == other.mask
 
     def __ne__(self, other):
         return not self.__eq__(other)
-- 
2.17.1


Re: [Qemu-devel] [PATCH] decodetree: Fix comparison of Field
Posted by Peter Maydell 4 years, 10 months ago
On Tue, 4 Jun 2019 at 16:42, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Typo comparing the sign of the field, twice, instead of also comparing
> the mask of the field (which itself encodes both position and length).
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  scripts/decodetree.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/decodetree.py b/scripts/decodetree.py
> index 81874e22cc..d7a59d63ac 100755
> --- a/scripts/decodetree.py
> +++ b/scripts/decodetree.py
> @@ -184,7 +184,7 @@ class Field:
>          return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
>
>      def __eq__(self, other):
> -        return self.sign == other.sign and self.sign == other.sign
> +        return self.sign == other.sign and self.mask == other.mask
>
>      def __ne__(self, other):
>          return not self.__eq__(other)
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This fixes the problems I was seeing with the VFP decodetree
conversion I was working on.

thanks
-- PMM

Re: [Qemu-devel] [PATCH] decodetree: Fix comparison of Field
Posted by Philippe Mathieu-Daudé 4 years, 10 months ago
On 6/4/19 5:42 PM, Richard Henderson wrote:
> Typo comparing the sign of the field, twice, instead of also comparing
> the mask of the field (which itself encodes both position and length).
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  scripts/decodetree.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/decodetree.py b/scripts/decodetree.py
> index 81874e22cc..d7a59d63ac 100755
> --- a/scripts/decodetree.py
> +++ b/scripts/decodetree.py
> @@ -184,7 +184,7 @@ class Field:
>          return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
>  
>      def __eq__(self, other):
> -        return self.sign == other.sign and self.sign == other.sign
> +        return self.sign == other.sign and self.mask == other.mask

Argh

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>  
>      def __ne__(self, other):
>          return not self.__eq__(other)
>