{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1689","repository_url":"https://api.github.com/repos/apple/swift-corelibs-foundation","labels_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1689/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1689/comments","events_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1689/events","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1689","id":359631293,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1MDc5MTk3","number":1689,"title":"(Arm32) Fix 32-bit Variable Offset Issues with CoreFoundation","user":{"login":"Kaiede","id":41651119,"node_id":"MDQ6VXNlcjQxNjUxMTE5","avatar_url":"https://avatars1.githubusercontent.com/u/41651119?v=4","gravatar_id":"","url":"https://api.github.com/users/Kaiede","html_url":"https://github.com/Kaiede","followers_url":"https://api.github.com/users/Kaiede/followers","following_url":"https://api.github.com/users/Kaiede/following{/other_user}","gists_url":"https://api.github.com/users/Kaiede/gists{/gist_id}","starred_url":"https://api.github.com/users/Kaiede/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kaiede/subscriptions","organizations_url":"https://api.github.com/users/Kaiede/orgs","repos_url":"https://api.github.com/users/Kaiede/repos","events_url":"https://api.github.com/users/Kaiede/events{/privacy}","received_events_url":"https://api.github.com/users/Kaiede/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-09-12T20:03:21Z","updated_at":"2018-09-13T02:11:20Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1689","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1689","diff_url":"https://github.com/apple/swift-corelibs-foundation/pull/1689.diff","patch_url":"https://github.com/apple/swift-corelibs-foundation/pull/1689.patch"},"body":"_CFInfo Assumes a 64-bit _cfinfoa type, when it is really 32-bit on 32-bit systems.\r\n_NSCFType assumes a 32-bit _cfinfoa too, making things even more complicated.\r\n\r\nThis impacts Swift on arm32v7 platforms like Raspberry Pi 3, and has been causing crashes when using Foundation types that bridge between C and Swift, because shared instance variables are offset by 4 bytes (the extra padding). String being a common example. \r\n\r\nThere's a couple approaches to addressing this:\r\n1) Back _CFInfo with a UInt that, on paper, matches size with __CFInfoType\r\n2) Add padding so we can guarantee that _CFInfo can always be 64-bit.\r\n\r\nWhich one you pick depends on if this is guaranteed to be true: Swift's UInt == CoreFoundation's __CFInfoType\r\n\r\nBecause Android has some interesting macros in the code that prevented me from answering this question with high confidence, this change picks option 2 which is less risky, even though it does mean an extra 4 bytes for each bridgable object. Option 1 would use less memory on 32-bit systems. \r\n\r\nIn either case, it makes sense that __NSCFType should be backed by a _CFInfo instead\r\nof a raw int type so that things remain consistent. Share types when possible so we have consistent, understandable behavior. Question is, does __NSCFType even get used anymore? Is it meant to back something else that always uses a 32-bit _cfinfo? \r\n\r\nIn terms of validation, this was tested on Raspbian Stretch, using armhf architecture (armv7 specifically), using an existing project (http://github.com/Kaiede/RPiLight) that was able to produce the original bug against the swift-4.1.2-RELEASE tag doing a 'swift test' on the package. To validate against swift-4.1.2-RELEASE, I also needed to cherry-pick commit 1086b3bb8b859dae10a2a6d6fda4dbbcac2698ae which fixes another 32-bit issue. The swift RC field is 32-bit on arm32, not 64, so that commit is required for 32-bit to work as well."},"comment":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/comments/420859358","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1689#issuecomment-420859358","issue_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1689","id":420859358,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDg1OTM1OA==","user":{"login":"millenomi","id":44005,"node_id":"MDQ6VXNlcjQ0MDA1","avatar_url":"https://avatars0.githubusercontent.com/u/44005?v=4","gravatar_id":"","url":"https://api.github.com/users/millenomi","html_url":"https://github.com/millenomi","followers_url":"https://api.github.com/users/millenomi/followers","following_url":"https://api.github.com/users/millenomi/following{/other_user}","gists_url":"https://api.github.com/users/millenomi/gists{/gist_id}","starred_url":"https://api.github.com/users/millenomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/millenomi/subscriptions","organizations_url":"https://api.github.com/users/millenomi/orgs","repos_url":"https://api.github.com/users/millenomi/repos","events_url":"https://api.github.com/users/millenomi/events{/privacy}","received_events_url":"https://api.github.com/users/millenomi/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T02:11:20Z","updated_at":"2018-09-13T02:11:20Z","author_association":"CONTRIBUTOR","body":"@swift-ci please test"}}
{"actor":{"display_login":"millenomi"}}