Bug 400491 - s390x: Operand of LOCH treated as unsigned integer
Summary: s390x: Operand of LOCH treated as unsigned integer
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: 3.14 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Arnez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-30 18:26 UTC by Andreas Arnez
Modified: 2018-11-14 15:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Sign-extend immediate operand of LOCHI and friends (1.56 KB, patch)
2018-10-30 18:44 UTC, Andreas Arnez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Arnez 2018-10-30 18:26:32 UTC
The immediate 16-bit operand of LOCHI (load halfword immediate on condition) is treated as an unsigned integer instead of a signed integer.  This also applies to LOCHHI and LOCGHI.
Comment 1 Andreas Arnez 2018-10-30 18:44:12 UTC
Created attachment 115989 [details]
Sign-extend immediate operand of LOCHI and friends

This patch fixes the issue by offering only the non-overlapping vector registers to the register allocator.
Comment 2 Andreas Arnez 2018-10-30 18:45:26 UTC
(In reply to Andreas Arnez from comment #1)
> Created attachment 115989 [details]
> Sign-extend immediate operand of LOCHI and friends
> 
> This patch fixes the issue by offering only the non-overlapping vector
> registers to the register allocator.
Oops, comment to wrong bug.  The patch fixes the issue by sign-extending the operand.
Comment 3 Julian Seward 2018-11-09 09:42:52 UTC
(In reply to Andreas Arnez from comment #2)
> Oops, comment to wrong bug.  The patch fixes the issue by sign-extending the
> operand.

Ah, fabulous stacked casts!  I think 3 levels is a new record for this
code base.

Seems fine.  OK to land.
Comment 4 Andreas Arnez 2018-11-14 15:37:18 UTC
(In reply to Julian Seward from comment #3)
> Ah, fabulous stacked casts!  I think 3 levels is a new record for this
> code base.
Actually it's done this way in several places in this file already...

> Seems fine.  OK to land.
Thanks, pushed as git commit 9545e9f96.