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 17491 - Compiles on invalid: *&s.init.var is not an lvalue #6893

Merged
merged 1 commit into from Jun 14, 2017

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 11, 2017

Same as #6892, but with added test case.

The idea here is that, the optimizer can simplify:

  • S(42).var -> 42, and
  • *&S(42).var -> S(42).var

But it is not able to (in one pass) go from:

  • *&S(42).var -> 42

Because of this, the compiler accepts an assignment to non-lvalue as valid code because it hasn't sufficiently determined that the LHS is infact a constant literal.

The first commit is a prerequisite for this fix. PowExp.optimize is code that I wrote a few years back, and fixing 17491 exposed a hidden bug in them.

Fixes dmd bug: https://issues.dlang.org/show_bug.cgi?id=17491
Fixes gdc bug: https://bugzilla.gdcproject.org/show_bug.cgi?id=151

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
17491 Compiles on invalid: *&s.init.var is not an lvalue

@ibuclaw ibuclaw force-pushed the issue17491 branch 3 times, most recently from 1dbb9a7 to 0ba565b Compare June 11, 2017 20:09
@WalterBright
Copy link
Member

This seems to have two independent things conflated - changing how PowExp works, and the *&s.init.var issue. Could you please separate them?

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 11, 2017

I can't separate them here until the first commit is merged. #6895

@WalterBright
Copy link
Member

I can't separate them here until the first commit is merged. #6895

It's been merged.

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 13, 2017

It's been merged.

Yes, and you may have noticed that I have already removed the other commit. ;-)

@WalterBright WalterBright merged commit becedff into dlang:master Jun 14, 2017
@ibuclaw ibuclaw deleted the issue17491 branch June 15, 2017 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants