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 22935 - importC: offsetof with array element gives 'derefer… #13925

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

WalterBright
Copy link
Member

…ence of invalid pointer'

Could use a refactoring to eliminate some copy/pasta, but that's best left to a followup.

@WalterBright WalterBright added the Feature:ImportC Pertaining to ImportC support label Mar 30, 2022
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
22935 normal importC: offsetof with array element gives 'dereference of invalid pointer'

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


import core.checkedint : mulu;
bool overflow;
const offset = mulu(index, ts.nextOf().size(e.loc), overflow);
Copy link
Contributor

Choose a reason for hiding this comment

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

D-scanner doesn't like this unused variable

Copy link
Contributor

@dkorpel dkorpel left a comment

Choose a reason for hiding this comment

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

Add tests for the error branches

@WalterBright WalterBright force-pushed the fix22935 branch 2 times, most recently from c1929c1 to b748fe9 Compare March 30, 2022 22:50
@RazvanN7 RazvanN7 merged commit cf1c279 into dlang:master Mar 31, 2022
@WalterBright WalterBright deleted the fix22935 branch March 31, 2022 23:18
@WalterBright
Copy link
Member Author

Appears to cause https://issues.dlang.org/show_bug.cgi?id=22976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ImportC Pertaining to ImportC support Severity:Bug Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants