[Issue 12051] New: Code generation issue on x86-64

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 31 15:44:54 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12051

           Summary: Code generation issue on x86-64
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: yazan.dabain at gmail.com


--- Comment #0 from yazan.dabain at gmail.com 2014-01-31 15:44:51 PST ---
A wrong code issue was found in DCD project commit e7f3952.
The code where the compiler fails to produce correct code is in
astconverter.d:558

  foreach (i, s; importInfo.importParts)
  {
    immutable kind = i + 1 < importInfo.importParts.length ?
                     CompletionKind.packageName : CompletionKind.moduleName;

    // Begin compiler bug workaround (this is part of the next commit, not
e7f3952)
    if (kind == 'L') std.stdio.writeln("ERROR ", kind);
    ...
   }

CompletionKind is a char enum (located in messages.d),
CompletionKind.packageName = 'P', CompletionKind.moduleName = 'M'

--------------------------------------------------

The assembly produced for this part of the code:

lea    0x1(%rbx),%rcx   
cmp    -0x1c0(%rbp),%rcx
sbb    %rsi,%rsi        
and    $0x3,%dh               <---------- wrong register, should be sil, not dh
add    $0x4d,%sil       

This code is the same on commit e7f3952 in an optimized build and on commit
2745763 in a non-optimized build.

However it is different in an optimized for commit 2745763.

The optimized code is:

lea    0x1(%r12),%rcx
cmp    -0xa0(%rbp),%rcx
sbb    %r13,%r13
and    $0x3,%r13b
add    $0x4d,%r13b

The code in the optimized build doesn't have the issue. And it runs as
expected.

--------------------------------------------------

Original discussion https://github.com/Hackerpilot/DCD/issues/92

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list