www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12051] New: Code generation issue on x86-64

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: yazan.dabain gmail.com



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: -------
Jan 31 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051




BTW, inline and possibly other flags are not required to reproduce the issue.
And removing it from the build script will speed up the compilation greatly.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 31 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com



Slowly, slowly reducing with dustmite.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|All                         |x86_64
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
            Summary|Code generation issue on    |Wrong code with ?:
                   |x86-64                      |resulting in char on x86-64



https://github.com/D-Programming-Language/dmd/pull/3182

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/558ff1217863936fbb3df9d01cb0bc4f8a11cd14
Fix Issue 12051 - Wrong code with ?: resulting in char on x86-64

https://github.com/D-Programming-Language/dmd/commit/1fdd3c6ace7ea0c5985d7c3041d4641b05b098df


Issue 12051 - Wrong code with ?: resulting in char on x86-64

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e39e0707f590fff45deebde81e5b34846ecdffed


Issue 12051 - Wrong code with ?: resulting in char on x86-64

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12051




Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b1ba7340cf028a3fd9857de2980b6eb611c0caef


Issue 12051 - Wrong code with ?: resulting in char on x86-64

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