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

--- Comment #3 from hst...@quickfur.ath.cx ---
P.S., in the bad code case, %rax contains the address of a local variable used
to store the static array, but %rdx appears to contain the correct return
value. Did the codegen somehow fail to leave the return value in the right
register?

-------
00000000004274e8 <ulong[1] test.parseDateRange()>:
  4274e8:       55                      push   %rbp
  4274e9:       48 8b ec                mov    %rsp,%rbp
  4274ec:       48 83 ec 20             sub    $0x20,%rsp
  4274f0:       48 8d 45 e8             lea    -0x18(%rbp),%rax
        // %rax := &(%rbp - 0x18)       
  4274f4:       31 c9                   xor    %ecx,%ecx
  4274f6:       48 89 08                mov    %rcx,(%rax)
        // local var (*%eax) := 0
  4274f9:       48 89 4d e8             mov    %rcx,-0x18(%rbp)
        // local var (%rbp - 0x18) := 0 (redundant store?)
  4274fd:       48 8b 55 e8             mov    -0x18(%rbp),%rdx
        // %rdx := *(%rbp - 0x18)       
  427501:       c7 45 f0 01 00 00 00    movl   $0x1,-0x10(%rbp)
  427508:       eb 0d                   jmp    427517 <ulong[1]
test.parseDateRange()+0x2f>
  42750a:       eb 0b                   jmp    427517 <ulong[1]
test.parseDateRange()+0x2f>
        // dead code? 
  42750c:       48 89 45 f8             mov    %rax,-0x8(%rbp)
  427510:       c7 45 f0 00 00 00 00    movl   $0x0,-0x10(%rbp)
        // dead code?                   
  427517:       83 7d f0 00             cmpl   $0x0,-0x10(%rbp)
  42751b:       75 09                   jne    427526 <ulong[1]
test.parseDateRange()+0x3e>
        // if (*(%rbp - 0x10) != 0)
  42751d:       48 8b 7d f8             mov    -0x8(%rbp),%rdi
  427521:       e8 7a fe ff ff          callq  4273a0 <_Unwind_Resume@plt>
  427526:       83 7d f0 01             cmpl   $0x1,-0x10(%rbp)
        // if (*(%rbp - 0x10) == 1) return;
  42752a:       74 06                   je     427532 <ulong[1]
test.parseDateRange()+0x4a>
  42752c:       83 7d f0 02             cmpl   $0x2,-0x10(%rbp)
  427530:       c9                      leaveq
  427531:       c3                      retq
  427532:       c9                      leaveq
  427533:       c3                      retq
-------

--

Reply via email to