[Issue 20441] Wrong code with -O -fPIC and string literal.ptr
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 12 09:28:13 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20441
--- Comment #3 from Don <clugdbug at yahoo.com.au> ---
And here is what the optimizer produces. The problematic instruction is
highlighted.
0x000055555558dbe8 <+0>: push %rbp
0x000055555558dbe9 <+1>: mov %rsp,%rbp
0x000055555558dbec <+4>: lea 0x31d6d(%rip),%rdi # 0x5555555bf960
0x000055555558dbf3 <+11>: callq 0x55555558dbdc <_moo>
=> 0x000055555558dbf8 <+16>: sub $0x31d66,%rax
0x000055555558dbfe <+22>: jne 0x55555558dc04 <_Dmain+28>
0x000055555558dc00 <+24>: xor %eax,%eax
0x000055555558dc02 <+26>: pop %rbp
0x000055555558dc03 <+27>: retq
The mistake is that the addressing mode flag to make it RIP-relative, is
missing.
Instead of
sub RAX, [RIP + 0x31d66]
it is generating
sub RAX, [0x31d66]
--
More information about the Digitalmars-d-bugs
mailing list