Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Issue 20461 - [dip1000] Passing stack allocated string to assert … #10947

Merged
merged 1 commit into from
Mar 27, 2020

Conversation

WalterBright
Copy link
Member

…compiles

Added an extra parameter to checkParamArgumentEscape() to make it work.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
20461 critical [dip1000] Passing stack allocated string to assert compiles

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#10947"

@Geod24
Copy link
Member

Geod24 commented Mar 20, 2020

Why would be assert be defined as escaping its argument ? assert can abort, writeln and crash, etc... Yes it can also throw, but I thought you weren't so in favor of this ?

@WalterBright
Copy link
Member Author

Because it does (unfortunately). See explanation here:

Blocked by dlang/druntime#2999

Frankly what happens when assert() gets called is a ridiculous sequence of Rube Goldberg trampolines, but fixing that is beyond the scope of this patch.

@WalterBright
Copy link
Member Author

Blocked by dlang/phobos#7426

@Geod24
Copy link
Member

Geod24 commented Mar 21, 2020

Fair enough. Personally not too thrilled about it (especially in the assert(0) case), as I might been using this pattern now and then. However, it should be a deprecation not to break code (as it already did in druntime and Phobos).

@WalterBright
Copy link
Member Author

However, it should be a deprecation not to break code (as it already did in druntime and Phobos).

The problem is (as pointed out in bugzilla) these are unnoticed critical errors - the message will be garbage. That code does not work, and in good conscience we should not issue deprecations for it, only errors.

@Geod24
Copy link
Member

Geod24 commented Mar 21, 2020

Right, I thought it might work with assert(0), but it's only with checkaction=C, so objection withdrawn.

@Geod24
Copy link
Member

Geod24 commented Mar 24, 2020

Can you rebase ?

@WalterBright
Copy link
Member Author

rebased

@12345swordy
Copy link
Contributor

@thewilsonator this needs manually merge it seems

@thewilsonator thewilsonator merged commit fb7f054 into dlang:master Mar 27, 2020
@Geod24
Copy link
Member

Geod24 commented Mar 27, 2020

In this case the CI just needed to be retriggered, the upstream bug has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants