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 16652 - [Reg 2.071] returned rvalue destroyed too early #9081

Merged
merged 1 commit into from
Dec 16, 2018

Conversation

WalterBright
Copy link
Member

@WalterBright WalterBright commented Dec 15, 2018

This is an ugly bug that makes RAII unreliable.

The fix is to inline functions as expressions, not statements, when the arguments to the function generate temporaries that need destruction. The destruction has to happen after the function body executes, and the code generator handles that nicely when they are expressions.

@WalterBright WalterBright added the Severity:Regression PRs that fix regressions label Dec 15, 2018
@dlang-bot
Copy link
Contributor

dlang-bot commented Dec 15, 2018

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
16652 regression [Reg 2.071] returned rvalue destroyed too early

⚠️⚠️⚠️ 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 fetch digger
dub run digger -- build "master + dmd#9081"

src/dmd/inline.d Outdated
* m = module to scan
*/
public void inlineScanModule(Module m)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated.

@WalterBright
Copy link
Member Author

Hmm. What's different about the circleci machines from the Linux ones that are passing?

@thewilsonator
Copy link
Contributor

dmd: dmd/backend/dwarfeh.d:204: Assertion 'n == 0' failed. debug I guess

@WalterBright
Copy link
Member Author

sdtor.d starts with PERMUTE_ARGS: -unittest -O -release -inline -fPIC -g which should cover it.

@WalterBright
Copy link
Member Author

Guess it's time to start a binary bisect of sdtor.d.

@WalterBright WalterBright force-pushed the fix16652 branch 5 times, most recently from 0750b3c to 80516e2 Compare December 15, 2018 21:10
@WalterBright
Copy link
Member Author

Hah, fixing this exposed another RAII bug, which I'm glad to fix.

@WalterBright WalterBright merged commit 040320d into dlang:master Dec 16, 2018
@WalterBright WalterBright deleted the fix16652 branch December 16, 2018 20:54
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.

3 participants