Title: Accessors of unions return dangling pointers for reinterpreted unions · Issue #311 · Cpp2Rust/cpp2rust · GitHub
Open Graph Title: Accessors of unions return dangling pointers for reinterpreted unions · Issue #311 · Cpp2Rust/cpp2rust
X Title: Accessors of unions return dangling pointers for reinterpreted unions · Issue #311 · Cpp2Rust/cpp2rust
Description: In refcount, when the union is reinterpreted, saving the pointer returned by a union accessor is resulting in a dangling pointer. For example: /* union U { int i; float f; }; */ pub struct U { __bytes: Value
Open Graph Description: In refcount, when the union is reinterpreted, saving the pointer returned by a union accessor is resulting in a dangling pointer. For example: /* union U { int i; float f; }; */ pub struct U { __by...
X Description: In refcount, when the union is reinterpreted, saving the pointer returned by a union accessor is resulting in a dangling pointer. For example: /* union U { int i; float f; }; */ pub struct U { __by...
Opengraph URL: https://github.com/Cpp2Rust/cpp2rust/issues/311
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Accessors of unions return dangling pointers for reinterpreted unions","articleBody":"In refcount, when the union is reinterpreted, saving the pointer returned by a union accessor is resulting in a dangling pointer. For example:\n\n```rs\n/*\nunion U {\n int i;\n float f;\n};\n*/\npub struct U {\n __bytes: Value\u003cBox\u003c[u8]>>,\n}\n\nimpl U {\n pub fn i(&self) -> Ptr\u003ci32> {\n (self.__bytes.as_pointer() as Ptr\u003cu8>).reinterpret_cast()\n }\n pub fn f(&self) -> Ptr\u003cf32> {\n (self.__bytes.as_pointer() as Ptr\u003cu8>).reinterpret_cast()\n }\n}\n\nfn foo() {\n let p: Ptr\u003c...> = ...;\n let reinterpreted_u: Ptr\u003cU> = p.reinterpret_cast();\n let p_i: Ptr\u003ci32> = reinterpreted_u.upgrade().deref().i();\n ...\n // p_i is dangling because reinterpreted_u.deref().upgrade() is creating a temporary union\n}\n```","author":{"url":"https://github.com/lucic71","@type":"Person","name":"lucic71"},"datePublished":"2026-08-17T13:15:38Z","url":"https://github.com/Cpp2Rust/cpp2rust/issues/311"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1510b728-835a-f395-955b-2257ad67c19c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82AE:DB09F:451228C:57FE7D6:6B024744 |
| html-safe-nonce | 900d89e91227403586fe13ea58c8853f6fe9cc51afb70819c8b13ec01e4644d1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkFFOkRCMDlGOjQ1MTIyOEM6NTdGRTdENjo2QjAyNDc0NCIsInZpc2l0b3JfaWQiOiI4MTY0NjMwMzY5NzI5NDMxNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2fd0c4d8490cd2db4e98ece8ed42050a79d3f82c77af559580df4ee0577f9d4c |
| hovercard-subject-tag | issue:5172290355 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Cpp2Rust/cpp2rust/311/issue_layout |
| twitter:image | https://opengraph.githubassets.com/349e53ceceae9b618e121461a5b3cd883fb16c0a35f6d2783990928f8ef3f1bc/Cpp2Rust/cpp2rust/issues/311 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/349e53ceceae9b618e121461a5b3cd883fb16c0a35f6d2783990928f8ef3f1bc/Cpp2Rust/cpp2rust/issues/311 |
| og:image:alt | In refcount, when the union is reinterpreted, saving the pointer returned by a union accessor is resulting in a dangling pointer. For example: /* union U { int i; float f; }; */ pub struct U { __by... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lucic71 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/Cpp2Rust/cpp2rust git https://github.com/Cpp2Rust/cpp2rust.git |
| octolytics-dimension-user_id | 197474191 |
| octolytics-dimension-user_login | Cpp2Rust |
| octolytics-dimension-repository_id | 1183095779 |
| octolytics-dimension-repository_nwo | Cpp2Rust/cpp2rust |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1183095779 |
| octolytics-dimension-repository_network_root_nwo | Cpp2Rust/cpp2rust |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width