Project

General

Profile

Actions

Defect #676

open

Register shortage

Added by Rochus Keller about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Category:
AMD64 Back-End
Target version:
-
% Done:

0%


Description

I get an error from asmparser.cpp on line 31478 of the attached dtoa.cod: invalid integer literal '1e'

The corresponding code is:

    mov    f8 [@WCEWioxoyW#tens + 120], f8 1000000000000000
    mov    f8 [@WCEWioxoyW#tens + 128], f8 10000000000000000
    mov    f8 [@WCEWioxoyW#tens + 136], f8 100000000000000000
    mov    f8 [@WCEWioxoyW#tens + 144], f8 1000000000000000000
    mov    f8 [@WCEWioxoyW#tens + 152], f8 10000000000000000000
    mov    f8 [@WCEWioxoyW#tens + 160], f8 1e+20                                             ; <--- line 31478
    mov    f8 [@WCEWioxoyW#tens + 168], f8 1e+21
    mov    f8 [@WCEWioxoyW#tens + 176], f8 1e+22

In Parser::Context::ParsePrimary the condition IsCurrent (Lexer::Integer) is true, and current.string is "1e" and symbol is ECS::Assembly::Lexer::Integer.


Files

dtoa.cod (718 KB) dtoa.cod Rochus Keller, 16 August 2024 18:21
dtoa.c (156 KB) dtoa.c Rochus Keller, 16 August 2024 18:52
Actions #1

Updated by Rochus Keller about 1 year ago

If I add the following code to asmlexer.cpp Lexer::ReadNumber, right after the "else if (stream && character == '.' )" clause

    else if( (character == '+' || character == '-') && !token.string.empty() &&
             token.string[token.string.size()-1]=='e' )
    {
        token.string.push_back (character);
        while (std::isdigit (stream.peek ()) && stream.get (character))
            token.string.push_back (character);
        token.symbol = Real;
    }

the number is correctly interpreted. But now I get a couple of "register shortage" errors from asmgenerator.cpp Generator::Context::Emit and an assertion

WCEWioxoyW#dtoa_r:640: error: register shortage
WCEWioxoyW#dtoa_r:641: error: register shortage
WCEWioxoyW#dtoa_r:644: error: register shortage
WCEWioxoyW#dtoa_r:647: error: register shortage
WCEWioxoyW#dtoa_r:648: error: register shortage
WCEWioxoyW#dtoa_r:650: error: register shortage
WCEWioxoyW#dtoa_r:652: error: register shortage

compiler: amd64generator.cpp:328: ECS::AMD64::Generator::Context::Ticket ECS::AMD64::Generator::Context::GetRegisterTicket(ECS::Code::Register, ECS::AMD64::Generator::Context::Index) const: Assertion `registers[index][register_] != tickets.end ()' failed.
Actions #2

Updated by Rochus Keller about 1 year ago

I also attached the source code in case you need it.

Actions #3

Updated by Florian Negele about 1 year ago

Thanks for the correction. The error basically means that an expression is too complicated to be evaluated with the limited register x86 register set. I will look into a solution for this.

Actions #4

Updated by Rochus Keller about 1 year ago

I have temporarily exchanged dtoa.c with a much simpler solution in strtod.c which seems to work good enough for the moment without the mentioned issue. So you can take your time .

Actions #5

Updated by Rochus Keller about 1 year ago

Maybe you can rename the issue to something like "x86 generator register shortage".

Actions #6

Updated by Florian Negele about 1 year ago

  • Subject changed from Asmparser interprets 1e-20 as integer to Register shortage
  • Category set to AMD64 Back-End
Actions

Also available in: Atom PDF