[Issue 12095] Wrong code with -O -inline
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 7 05:27:06 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12095
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies at gmail.com
--- Comment #4 from yebblies <yebblies at gmail.com> 2014-02-08 00:27:04 EST ---
The optimizer is turning fun into this:
push ecx ; 0000 _ 51
mov eax, 5 ; 0001 _ B8, 00000005
call _D5testx8__assertFiZv ; 0006 _ E8,
00000000(rel)
add esp, 4 ; 000B _ 83. C4, 04
ret 4 ; 000E _ C2, 0004
The optimizer sees
el:00362EB4 cnt=0 ? TYvoid 00362344 00362E7C
el:00362344 cnt=0 const TYint 0L
el:00362E7C cnt=0 colon TYvoid 00362D2C 00362E44
el:00362D2C cnt=0 || TYvoid 0036237C 00361F20
el:0036237C cnt=0 var TYint a
el:00361F20 cnt=0 call TYvoid 00361F58 0036230C
el:00361F58 cnt=0 var TYD func _D5testx8__assertFiZv
el:0036230C cnt=0 const TYint 5L
el:00362E44 cnt=0 || TYvoid 00362D64 00362E0C
el:00362D64 cnt=0 const TYint 1L
el:00362E0C cnt=0 call TYvoid 00362DD4 00362D9C
el:00362DD4 cnt=0 var TYD func _D5testx8__assertFiZv
el:00362D9C cnt=0 const TYint 7L
And it brilliantly deduces that as e2 is `1 || assert, void` -> `void` it can
replace it with null.
Then, seeing e2 is null, it reduces OPcolon down to just `a || assert`
Then the code in elcond goes 'hey, the cond is 0 so I'll just take e2'.
So then we're left with just assert.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list