[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] tools/tests/x86_emulator: fix 'shifting a negative signed value is undefined'
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Edwin Torok <edwin.torok@xxxxxxxxxx>
- Date: Tue, 24 Feb 2026 10:12:27 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6LgKHM+p6kcqzv46VIenPq+SJJPnA9x2y5hyHac4Cl8=; b=vVCz0SUR+Yhb/3o7GCpZgeVKomp9x2Zt64g8FMkr6/ARE7TLM9ExwgE/JWjp0oGJqZDA/kwXPaExIWMM9ghNpkyWk1wLb0GLxgTSHYx0CAYT7gBBCRw3+HJuYOYxAiVCja+GdVQiXDbziK1p6IIPzmPyG4LXk//qM3u7rnCPC8D05y1JzmY8zSJgS0cOdF+lXT1N66MLPJOeSt5nBLdyiyLXcOQK7njrb3ODjW8yn2vrMQ3GZG5l730+zYkMWsdRoo15/1tslkYGNQb4AXoq8osVioY1E7c3HNjkjgipwcZlEXiLDBgB3KLCZZ21nLw6J/DlbNRI5/hZswj5mk7g7w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o4axRFjmGhW8bGeLanuIIAvA2a+l2mXAHtk+7pYYVJGLthgvLGCbA2Oh2CfnFAMqCFZ35Blt2Xo/SYXuq2MRefljMB6LD5J9QFr/wxQ/qiR4v7KCatHJFwMnFjX1EpF6BDMi9oCfXT5a/oyQMyTC3+SM6DiCiivLYblBUvUDVhYyx2hbyB3Dv72QoKzLTfbznJ8+zrez0aa/x2yWOwTaccx7jAWOq+QzqEDeVVXAP/fI7G7944MutJClOoxAghDCjX2GHAKpYYXCh6Oe/pjomy2R3G4mOFHFKN4VMCmaHfASerSDjgtsdiZ6qc56XpXeOjqAft7w+dzutC47bO/4yA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 24 Feb 2026 10:12:40 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcpKvhICvggy+CX02UgLA2L8U/0bWQbKoAgAE2GYA=
- Thread-topic: [PATCH 1/4] tools/tests/x86_emulator: fix 'shifting a negative signed value is undefined'
> On 23 Feb 2026, at 15:42, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 23.02.2026 11:04, Edwin Török wrote:
>> --- a/tools/tests/x86_emulator/test_x86_emulator.c
>> +++ b/tools/tests/x86_emulator/test_x86_emulator.c
>> @@ -1161,7 +1161,7 @@ int main(int argc, char **argv)
>> instr[0] = 0x4d; instr[1] = 0x0f; instr[2] = 0xbb; instr[3] = 0x03;
>> regs.eflags = EFLAGS_ALWAYS_SET;
>> regs.rip = (unsigned long)&instr[0];
>> - regs.r8 = (-1L << 40) + 1;
>> + regs.r8 = (~0ULL << 40) + 1;
>
> While -1 vs ~0 doesn't make a big difference, I think we want to stick to
> "register size" here, and hence have only UL as the suffix. Then (happy to
> adjust while committing):
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
>
That is what I tried initially, but I got an error that the shift exceeds the
width of the type in (0UL << 40).
(I think the failure was with -m32 in the CI, but can’t find it now)
Best regards,
—Edwin
|