D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21779 - assert not omitted for -release -checkaction=context
Summary: assert not omitted for -release -checkaction=context
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-28 23:26 UTC by moonlightsentinel
Modified: 2021-03-29 01:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description moonlightsentinel 2021-03-28 23:26:54 UTC
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 Dlang Bot 2021-03-29 01:16:02 UTC
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