#221 new
Peter Johnson

x86_64 xor/and/or warns about constant expressions exceeding 32-bits

Reported by Peter Johnson | June 25th, 2011 @ 07:52 PM

Originally posted on Trac by anonymous
Original Trac Ticket

  Description

With the version got from git and compiled with MSVC
yasm 1.1.99.HEAD
Compiled on Apr 4 2011.

the following inst:

xor rax,0FFFFFFFFFFFFFFF0h

emits a warning 'value does not fit in 32 bit field'.

This is also true for and, or.

No warning should be emitted here.

Daniel

Trac Attachments

h3. Trac Comments
comment:1

              Changed 3 months ago by anonymous


As far as I understand the matter, the YASM source code adheres to ANSI C specifications - and there is no 64-bit data type which could be used to hold constants. The guarantee is only 32 bit. So, although you are perfectly right that a command like the one you cite should be possible, it is impossible for a cross-platform assembler like YASM to do this. Workaround:  Define your 64-bit number as a label.
E.g.,

xor rax, [maskFF]
.....
maskFF: dq 0FFFFFFFFFFFFFFF0h

Martin

comment:2

              Changed 3 months ago by peter@tortall.net


Yasm is ANSI C, but it has a bignum implementation so integers are actually handled as 256-bit values.

This bug is indeed a real one.  While immediate values in amd64 are restricted to 32-bit (with one exception: a special form of mov reg, imm), most are sign extended.  In this case, yasm should detect that the specified 64-bit value meets the sign extension criteria and not generate a warning.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Tags

Pages