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 'reinterpret' casts of StringExp to static array with implicit extension #9321

Merged
merged 1 commit into from
Feb 4, 2019

Conversation

kinke
Copy link
Contributor

@kinke kinke commented Feb 3, 2019

Fixes issue 19639.

@dlang-bot
Copy link
Contributor

dlang-bot commented Feb 3, 2019

Thanks for your pull request and interest in making D better, @kinke! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
19639 regression Initializing static array with slice enum of different length crashes the compiler

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#9321"

void main()
{
{
char[64] buf = EMPTY_STRING;
Copy link
Contributor Author

@kinke kinke Feb 3, 2019

Choose a reason for hiding this comment

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

Currently segfaults the compiler (the EMPTY_STRING buffer (StringExp.string) as memcpy source is null).

{
char[64] buf = SMALL_STRING;
assert(buf[0] == 'a');
foreach (c; buf[1..$]) assert(c == 0);
Copy link
Contributor Author

@kinke kinke Feb 3, 2019

Choose a reason for hiding this comment

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

Currently likely to fail or crash as the compile-time memcpy reads beyond the SMALL_STRING buffer.

@kinke kinke changed the title Fix 'reinterpret' casts of StringExp with implicit extension Fix 'reinterpret' casts of StringExp to static array with implicit extension Feb 3, 2019
@ghost
Copy link

ghost commented Feb 3, 2019

This looks good but the PR can be submitted for the stable branch as it fixes a regression.

@kinke
Copy link
Contributor Author

kinke commented Feb 4, 2019

I had it on stable and then switched to master, as I deemed it better suited (sooner in nightlies). It's a sort of regression - the crash for the first test block happens since v2.071, while the read-beyond-src-buffer has apparently been there since v2.068 (https://run.dlang.io/is/oPq799).

Implicit extension was apparently added with v2.066.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

all right, pink @thewilsonator

@dlang-bot dlang-bot merged commit 4553470 into dlang:master Feb 4, 2019
@kinke kinke deleted the fix19639 branch February 5, 2019 19:49
@kinke
Copy link
Contributor Author

kinke commented Feb 5, 2019

Hmm, the bugzilla issue wasn't auto-closed...

@wilzbach
Copy link
Member

wilzbach commented Feb 6, 2019

Hmm, the bugzilla issue wasn't auto-closed.

The Bugzilla integration closes only things when they are merged in master automatically. Stable was turned off as too many people complained about lots of emails on new releases. Though IMHO that's a lot less worse than an integration which doesn't seem to work...

@kinke
Copy link
Contributor Author

kinke commented Feb 6, 2019

@wilzbach: That's why I was wondering, this targeted master.

@wilzbach
Copy link
Member

wilzbach commented Feb 6, 2019

Sorry. Only read this from my phone. Then I also don't know what went wrong 🤷‍♂️
Maybe because GitHub services are deprecated and to be removed eventually?

image

@wilzbach
Copy link
Member

wilzbach commented Feb 6, 2019

Ah well, there's an explanation: https://developer.github.com/changes/2018-04-25-github-services-deprecation


May 31, 2018: Submit your intentions for migrating or replacing your GitHub Service.
October 1, 2018: GitHub discontinues allowing users to install services. GitHub Services will be removed from the GitHub.com UI.
January 29, 2019: As an alternative to the email service, you can now start using email notifications for pushes to your repository. See "About email notifications for pushes to your repository" in the GitHub Help documentation to learn how to configure commit email notifications.
January 31, 2019: GitHub stops delivering installed services' events on GitHub.com.


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.

4 participants