Defect #676
open
Added by Rochus Keller about 1 year ago.
Updated about 1 year ago.
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
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.
I also attached the source code in case you need it.
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.
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 .
Maybe you can rename the issue to something like "x86 generator register shortage".
- Subject changed from Asmparser interprets 1e-20 as integer to Register shortage
- Category set to AMD64 Back-End
Also available in: Atom
PDF