[Issue 6205] Strongly-pure nothrow functions with ignored return value are entirely stripped even if it contains a failing 'assert'.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 4 03:08:04 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6205
--- Comment #4 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list