http://d.puremagic.com/issues/show_bug.cgi?id=6205



--- Comment #4 from Kenji Hara <k.hara...@gmail.com> 2012-01-04 03:07:56 PST ---
I think this is 'too early optimization' bug.

Mechanism:
1. The calling of a function that is strong-pure and nothrow is 'no side
effect'.
   Then dmd marks it in IR level.

   https://github.com/D-Programming-Language/dmd/blob/master/src/e2ir.c#L286

2. OPucallns and OPcallns are completely removed in backend optimizer level.

   
https://github.com/D-Programming-Language/dmd/blob/master/src/backend/cgelem.c#L4088

   
https://github.com/D-Programming-Language/dmd/blob/master/src/backend/cgelem.c#L4385

The mistaken is in #1. assert() has 'implicit side effect' (throw AssertError,
or halt), so all of function call with enabling assertion should disable
'remove no side effect calling' optimization.

At least, a compilation without -O switch should not remove such calls.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to