[Issue 18461] core.bitop.bt returns garbage in release code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 18 23:44:52 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18461
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Component|phobos |dmd
--- Comment #7 from ag0aep6g at gmail.com ---
Good code generated with `-O -inline` (no `-release`):
----
0000000000000000 <_Dmain>:
0: 55 push rbp
1: 48 8b ec mov rbp,rsp
4: 48 83 ec 10 sub rsp,0x10
8: 48 c7 45 f8 10 00 00 mov QWORD PTR [rbp-0x8],0x10
f: 00
10: 48 8d 45 f8 lea rax,[rbp-0x8]
14: 48 0f ba 20 04 bt QWORD PTR [rax],0x4
----
Bad code with `-release -O -inline`:
----
0000000000000000 <_Dmain>:
0: 55 push rbp
1: 48 8b ec mov rbp,rsp
4: 48 83 ec 10 sub rsp,0x10
8: 48 8d 45 f8 lea rax,[rbp-0x8]
c: 48 0f ba 20 04 bt QWORD PTR [rax],0x4
----
Note that `mov QWORD PTR [rbp-0x8],0x10` is missing in the bad code. I.e.,
`test_val` doesn't get initialized.
--
More information about the Digitalmars-d-bugs
mailing list