#82 ✓resolved
Peter Johnson

Preprocessor/Compatibility: Integer to string formatting has changed to use hexadecimal instead of decimal

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

Originally posted on Trac by dnegrescu@hotmail.com
Original Trac Ticket

  Description

I have tried the latest snapshoot (1655) with some source code that compiles fine with version 0.5.0, and I've run into the following issue:

It appears that the 'nasm' preprocessor is now converting numeric values to string representation using the hexadecimal notation (e.g. 1 is converted to "0x1"), while the original 'nasm' and yasm 0.5.0 are using the decimal notation (e.g. 1 is converted to "1").

While this might appear to be benign/minor issue, it really has serious implications (at least for me).

As an exemple the following macro doesn’t produce anymore the expected code:

;... code sample start

%macro testConcat 0

%push ctx %assign %$x 0 %rep 8

movd eax, mm%$x
;.... code removed %assign %$x %$x+1

%endrep %pop

%endmacro

testConcat

;... code sample end

Trac Attachments

h3. Trac Comments
comment:1

              Changed 5 years ago by peter@tortall.net


Oops, this was broken in [1488], I think as a well-intentioned but poorly-thought-out  optimization.  I'll commit a fix asap.

comment:2

              Changed 5 years ago by peter


(In [1657]) Fix #84: I broke the idiom of concating a decimal number to a register
in the preproc (e.g mm%$x -> mm0) when I implemented a minor optimization
(outputing values in hex to avoid the 2x decimal conversion overhead) in
[1488].  Revert that optimization.

I believe the right way to do this is to add the GAS (and MASM) syntax
sugar of mm(0) etc. to NASM syntax, then any number (not just decimal)
can be used as the new idiom for doing this.  But that wouldn't unbreak
programs that already exist, so we're left with this state of affairs.
Sigh.

      comment:2

                  Changed 5 years ago by peter

      Status
        changed from new to closed
    
      Resolution
        set to fixed

(In [1657]) Fix #84: I broke the idiom of concating a decimal number to a register
in the preproc (e.g mm%$x -> mm0) when I implemented a minor optimization
(outputing values in hex to avoid the 2x decimal conversion overhead) in
[1488].  Revert that optimization.

I believe the right way to do this is to add the GAS (and MASM) syntax
sugar of mm(0) etc. to NASM syntax, then any number (not just decimal)
can be used as the new idiom for doing this.  But that wouldn't unbreak
programs that already exist, so we're left with this state of affairs.
Sigh.

      Status
        changed from new to closed
    
      Resolution
        set to fixed

comment:3

              Changed 5 years ago by dnegrescu@hotmail.com


Peter,

Thank you for your fast action. I've tried the 1657 snapshot and it works as expected.

Dan.

No comments found

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

Pages