Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[agg24]: Fix bad pointer arithmetic #17248

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

Closed
wants to merge 1 commit into from

Conversation

tkoeppe
Copy link

@tkoeppe tkoeppe commented Apr 27, 2020

The array c is an array of value_type[4], and thus its initial pointer
cannot be arbitrarily advanced (without causing undefined
behaviour). What seems to be desired instead is to consider the
containing object as a member of an array and perform arithmetic in
that array. This can be done by first computing the pointer to the
ambient object.

The array c is an array of value_type[4], and thus its initial pointer
cannot be arbitrarily advanced (without causing undefined
behaviour). What seems to be desired instead is to consider the
_containing_ object as a member of an array and perform arithmetic in
_that_ array. This can be done by _first_ computing the pointer to the
ambient object.
@tkoeppe
Copy link
Author

tkoeppe commented Apr 27, 2020

Note that #16975 goes a different way here, possibly a better one. We should probably use that one instead.

@tkoeppe
Copy link
Author

tkoeppe commented Apr 27, 2020

Closing this in favour of #16975, which seems like a better fix.

@tkoeppe tkoeppe closed this Apr 27, 2020
@tkoeppe tkoeppe deleted the pointer_arith branch April 30, 2020 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant