Bug 21779 – assert not omitted for -release -checkaction=context

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-28T23:26:54Z
Last change time
2021-03-29T01:16:02Z
Assigned to
No Owner
Creator
moonlightsentinel
See also
https://issues.dlang.org/show_bug.cgi?id=21778

Comments

Comment #0 by moonlightsentinel — 2021-03-28T23:26:54Z
The following code passes when compiled with -release but fails when adding -checkaction=context: ---------------------------------------------- int boo() { assert(false); } void main() { assert(boo()); // Should be omitted } ---------------------------------------------- dmd -release -run test.d => Success dmd -release -checkaction=context -run test.d => Failure
Comment #1 by dlang-bot — 2021-03-29T01:16:02Z
dlang/dmd pull request #12315 "Fix 21779 - Don't generate messages for disabled assertions" was merged into master: - e2320afc2b8eb7109d8c87706433e1cb74a763c5 by MoonlightSentinel: Fix 21779 - Don't generate messages for disabled assertions Only generate messages when the assert is not omitted due to `-release` or `-check=assert=off`. The rewrite to create a temporary seems to prevent the ellision (and is a waste of time anyways). https://github.com/dlang/dmd/pull/12315