[Issue 18461] core.bitop.bt returns garbage in release code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 20 10:50:58 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18461
bitter.taste at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bitter.taste at gmx.com
Component|phobos |dmd
--- Comment #9 from bitter.taste at gmx.com ---
This is a (major?) codegen bug in dmd, the joint action of -inline and -release
makes the rmdeadass kill the `test_val' definition and fold the argument `p' of
the `bt' function into `&test_val': that's right, the variable is gone but the
reference to it is still there, leading to the generation of the silly `lea'
instruction pointing into the stack.
Some more details for the lovers of the gory details:
```
ambiguous lvalue: test_val(0) = 16LL
assnod[0]: test_val(0) = 16LL
POSS
DEAD=0, live=0
dead assignment (test_val(0) = 16LL ) Boutlv
elimass
el:0x55687ec1d360 cnt=0 = TYuns long long 0x55687ec1d170 0x55687ec1d300
el:0x55687ec1d170 cnt=0 var TYuns long long test_val
el:0x55687ec1d300 cnt=0 const TYuns long long 16LL
assnod[1]: p(1) = #test_val(0)
POSS
DEAD=0, live=0
dead assignment (p(1) = #test_val(0)) Boutlv
elimass
el:0x55687ec1d9f0 cnt=0 = mTYconst|TY* 0x55687ec1d810 0x55687ec1d8d0
el:0x55687ec1d810 cnt=0 var mTYconst|TY* p
el:0x55687ec1d8d0 cnt=0 relconst TY* 0+& test_val
assnod[2]: bitnum(2) = 4LL
POSS
DEAD=0, live=0
dead assignment (bitnum(2) = 4LL ) Boutlv
elimass
el:0x55687ec1dcc0 cnt=0 = TYuns long long 0x55687ec1dba0 0x55687ec1dc60
el:0x55687ec1dba0 cnt=0 var TYuns long long bitnum
el:0x55687ec1dc60 cnt=0 const TYuns long long 4LL
```
If I understand correctly what's going on the variables are killed even though
they're not dead because they don't escape the block (they're not in Boutlv).
--
More information about the Digitalmars-d-bugs
mailing list