On 2/4/21 8:29 AM, Philippe Mathieu-Daudé wrote:
> The code is currently comparing c2 to the type promotion of
> uint32_t and int32_t. That is, the conversion rules are as:
> 
>   (common_type) c2 == (common_type) (uint32_t)
>                         (is_unsigned
>                         ? (uint32_t)c2
>                         : (uint32_t)(int32_t)c2)
> 
> In the signed case we lose the desired sign extensions because
> of the argument promotion rules of the ternary operator.
> 
> Solve the problem by doing the round-trip parsing through the
> intermediate type and back to the desired common type (all at
> one expression).
> 
> Fixes: a534bb15f30 ("tcg/s390: Use constant pool for cmpi")
> Reported-by: Miroslav Rezanina <mreza...@redhat.com>
> Reported-by: Richard W.M. Jones <rjo...@redhat.com>
> Suggested-by: David Hildenbrand <da...@redhat.com>
> Suggested-by: Eric Blake <ebl...@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
> ---
>  tcg/s390/tcg-target.c.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

A most excellent catch, thanks.  Queued.


r~

Reply via email to