[Issue 13007] New: Wrong x86 code: long negate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 29 10:21:13 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13007

          Issue ID: 13007
           Summary: Wrong x86 code: long negate
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: dragoscarp at gmail.com

Created attachment 1367
  --> https://issues.dlang.org/attachment.cgi?id=1367&action=edit
sample code

The attached example compiled with dmd 2.065 (flags: -m32 -O -inline) generates
wrong code for negative of a SysTime value:

 8093c76:       89 c2                   mov    %eax,%edx
 8093c78:       8b 45 f8                mov    -0x8(%ebp),%eax   <-- lower part
in eax
 8093c7b:       f7 d8                   neg    %eax
 8093c7d:       89 55 c4                mov    %edx,-0x3c(%ebp)
 8093c80:       8b 55 fc                mov    -0x4(%ebp),%edx   <-- higher
part in eax
 8093c83:       f7 da                   neg    %edx
 8093c85:       19 da                   sbb    %ebx,%edx  <-- ERROR: eax carry
was overwritten by the previous negation

Even Baz is not used in foo, the error is present only if foo.d is compiled
together with baz.d (foo.d baz.d -c).

With DMD master/HEAD the bug is not reproducible, because the generated code is
quite different.

--


More information about the Digitalmars-d-bugs mailing list