View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0035953 | FPC | Compiler | public | 2019-08-12 03:15 | 2019-08-15 01:51 |
Reporter | Do-wan Kim | Assigned To | J. Gareth Moreton | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.3.1 | Product Build | 42655 | ||
Target Version | Fixed in Version | 3.3.1 | |||
Summary | 0035953: Error in inline assembly code after r42655. | ||||
Description | I got following error with fpc trunk r42655. --------------------------------------------------------------------- Hint: (11030) Start of reading config file C:\development\fpc\bin\i386-win32\fpc.cfg Hint: (11031) End of reading config file C:\development\fpc\bin\i386-win32\fpc.cfg Free Pascal Compiler version 3.3.1-r42655 [2019/08/12] for i386 Copyright (c) 1993-2019 by Florian Klaempfl and others (1002) Target OS: Win32 for i386 (3104) Compiling assembler_test.lpr F:\delphiprj-new\lr_proj\test\assembler_test.lpr(55,20) Error: (7049) Assembler syntax error in operand assembler_test.lpr(67) Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: C:\development\fpc\bin\i386-win32\ppc386.exe returned an error exitcode | ||||
Steps To Reproduce | This code from MPArith library. ------------------------------------------------ program assembler_test; {$mode objfpc}{$H+} {$asmmode INTEL} {$R *.res} function __gcd32: longint; assembler; {-Calculate GCD of unsigned (A,B) in (eax,edx)} asm push ebx {done if A=B, otherwise if A<B then swap A and B} cmp eax,edx jz @@x jae @@1 xchg eax,edx {here eax >= edx. Calculate odd parts a,b with A=a*2^e(a), B=b*2^e(b)} @@1: bsf ecx, edx {if B=0 return A} jz @@x bsf ebx, eax {ebx=e(a), A cannot be zero} shr edx, cl {edx=b} xchg ebx, ecx shr eax, cl {eax=a} cmp ebx,ecx {ebx = e = min(e(a),e(b)} jb @@2 mov ebx,ecx @@2: cmp eax,edx {compare a and b} jz @@4 {done if equal} {in the main loop both a and b are always odd} {therefore for |a-b| is even and non-zero} push esi @@3: mov esi, eax {eax=a, edx=b} {calculate max(a,b) and min(a,b) without branches} {see H.S.Warren, Hacker's Delight, Revision 1/4/07} {http://www.hackersdelight.org/revisions.pdf} sub esi, edx {esi=a-b} sbb ecx, ecx {if a>=b then ecx=0 else ecx=-1} and esi, ecx {if a>=b then esi=0 else esi=a-b} add edx, esi {if a>=b then edx=b else edx=a, i.e. edx=min(a,b)} sub eax, esi {if a>=b then eax=a else eax=a-(a-b)=b=max(a,b)} sub eax, edx {a'=max(a,b)-min(a,b), b'=min(a,b)} bsf ecx, eax {a'=|a-b| is even, divide out powers of 2} shr eax, cl cmp eax, edx {compare new a and new b} jnz @@3 {and repeat loop if not equal} pop esi @@4: mov ecx, ebx {shift by initial common exponent e} // <---- Error: (7049) Assembler syntax error in operand shl eax, cl @@x: pop ebx end; begin __gcd32; end. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 42656 | ||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
assembler_test.lpr (1,986 bytes) |
|
Temporary fix.
rax86int.pas-35953.patch (438 bytes)
Index: compiler/x86/rax86int.pas =================================================================== --- compiler/x86/rax86int.pas (revision 42655) +++ compiler/x86/rax86int.pas (working copy) @@ -2714,7 +2714,7 @@ else begin - Message(asmr_e_syn_operand); + //Message(asmr_e_syn_operand); RecoverConsume(true); break; end; |
|
Thank you! |
|
This fix is only temporary, so it needs to be followed up, since that may be a legitimate error at other times. I will see if I can fix it myself. |
|
I don't think that Florian just applied the patch, see https://github.com/graemeg/freepascal/commit/febad29d6ce2c713855332803a2a0942786307d3 It also includes a test based on the instruction above but no idea where to check if the test passes. (Does a website for this exists?) |
|
I'll do some investigations and close it again if all is well - I was under the assumption that this report was marked as 'fixed' based on the patch supplied, since there's no other information to indicate otherwise. |
|
@J. Gareth Moreton: The "Fixed in Revision" field is set with that you can look at the changes: https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=42656 |
|
Apologies - the error message wasn't commented out in the trunk and the root issue is actually fixed. I apologise for my misinterpretation - re-closing this issue as it is fixed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-08-12 03:15 | Do-wan Kim | New Issue | |
2019-08-12 03:17 | Do-wan Kim | File Added: assembler_test.lpr | |
2019-08-12 05:55 | Do-wan Kim | File Added: rax86int.pas-35953.patch | |
2019-08-12 05:55 | Do-wan Kim | Note Added: 0117647 | |
2019-08-12 12:54 | Florian | Assigned To | => Florian |
2019-08-12 12:54 | Florian | Status | new => resolved |
2019-08-12 12:54 | Florian | Resolution | open => fixed |
2019-08-12 12:54 | Florian | Fixed in Version | => 3.3.1 |
2019-08-12 12:54 | Florian | Fixed in Revision | => 42656 |
2019-08-12 12:54 | Florian | FPCTarget | => - |
2019-08-12 16:39 | Do-wan Kim | Status | resolved => closed |
2019-08-12 16:39 | Do-wan Kim | Note Added: 0117655 | |
2019-08-12 22:56 | J. Gareth Moreton | Assigned To | Florian => J. Gareth Moreton |
2019-08-12 22:56 | J. Gareth Moreton | Status | closed => feedback |
2019-08-12 22:56 | J. Gareth Moreton | Resolution | fixed => reopened |
2019-08-12 22:56 | J. Gareth Moreton | Note Added: 0117659 | |
2019-08-12 22:56 | J. Gareth Moreton | Note Edited: 0117659 | View Revisions |
2019-08-12 22:58 | J. Gareth Moreton | Status | feedback => assigned |
2019-08-13 09:20 | rd0x | Note Added: 0117660 | |
2019-08-13 09:22 | rd0x | Note Edited: 0117660 | View Revisions |
2019-08-13 22:03 | J. Gareth Moreton | Note Added: 0117663 | |
2019-08-14 13:28 | Sven Barth | Note Added: 0117669 | |
2019-08-15 01:51 | J. Gareth Moreton | Status | assigned => closed |
2019-08-15 01:51 | J. Gareth Moreton | Resolution | reopened => fixed |
2019-08-15 01:51 | J. Gareth Moreton | Note Added: 0117676 |