{"action":"closed","number":246,"pull_request":{"url":"https://api.github.com/repos/klee/klee/pulls/246","id":38193575,"html_url":"https://github.com/klee/klee/pull/246","diff_url":"https://github.com/klee/klee/pull/246.diff","patch_url":"https://github.com/klee/klee/pull/246.patch","issue_url":"https://api.github.com/repos/klee/klee/issues/246","number":246,"state":"closed","locked":false,"title":"Fixed a bug with how non power 2 types were written to memory","user":{"login":"kren1","id":310855,"avatar_url":"https://avatars.githubusercontent.com/u/310855?v=3","gravatar_id":"","url":"https://api.github.com/users/kren1","html_url":"https://github.com/kren1","followers_url":"https://api.github.com/users/kren1/followers","following_url":"https://api.github.com/users/kren1/following{/other_user}","gists_url":"https://api.github.com/users/kren1/gists{/gist_id}","starred_url":"https://api.github.com/users/kren1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kren1/subscriptions","organizations_url":"https://api.github.com/users/kren1/orgs","repos_url":"https://api.github.com/users/kren1/repos","events_url":"https://api.github.com/users/kren1/events{/privacy}","received_events_url":"https://api.github.com/users/kren1/received_events","type":"User","site_admin":false},"body":"This is meant to fix a bug which manifests itself in the following two snippets:\r\n\r\n```C\r\nunion U0 {\r\n\tsigned f3 :18;\r\n};\r\n\r\nstatic union U0 g_988 = { 0UL };\r\n\r\nint main(int argc, char* argv[]) {\r\n\tg_988.f3 = 534;\r\n\tprintf(\"f3 %d \\n\", g_988.f3);\r\n\treturn 0;\r\n}\r\n```\r\nThis one works on the current master if pragma pack(1) is removed:\r\n```C\r\n#include <stdio.h>\r\n#pragma pack(1)\r\nstruct S0 {\r\n\tsigned f0 :20;\r\n};\r\n\r\nstatic struct S0 x;\r\nint main(int argc, char* argv[]) {\r\n\r\n\tx = (struct S0 ) { .f0 = 32 };\r\n\tprintf(\"integer %d\\n\", x.f0);\r\n\treturn x.f0;\r\n}\r\n```\r\n\r\nWhat happens is that in these cases w = 24, which makes it jump to Int8 case in the switch(w), which causes the wrong value to be stored. I've added a check to make sure that w is a power of 2, so it definitively fits into one of the switch cases and uses the slow version in all the others. \r\n\r\nI think this is a better option than adding Int24 into the switch since then all the others are also needed.","created_at":"2015-06-22T00:24:49Z","updated_at":"2015-12-17T19:52:08Z","closed_at":"2015-12-17T19:52:08Z","merged_at":null,"merge_commit_sha":"80a8fd211149d12fbac941f299334d7ba66fe3f2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/klee/klee/pulls/246/commits","review_comments_url":"https://api.github.com/repos/klee/klee/pulls/246/comments","review_comment_url":"https://api.github.com/repos/klee/klee/pulls/comments{/number}","comments_url":"https://api.github.com/repos/klee/klee/issues/246/comments","statuses_url":"https://api.github.com/repos/klee/klee/statuses/cb77cbb4841cec76b4bc19b6a8784b812c3034cd","head":{"label":"kren1:master","ref":"master","sha":"cb77cbb4841cec76b4bc19b6a8784b812c3034cd","user":{"login":"kren1","id":310855,"avatar_url":"https://avatars.githubusercontent.com/u/310855?v=3","gravatar_id":"","url":"https://api.github.com/users/kren1","html_url":"https://github.com/kren1","followers_url":"https://api.github.com/users/kren1/followers","following_url":"https://api.github.com/users/kren1/following{/other_user}","gists_url":"https://api.github.com/users/kren1/gists{/gist_id}","starred_url":"https://api.github.com/users/kren1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kren1/subscriptions","organizations_url":"https://api.github.com/users/kren1/orgs","repos_url":"https://api.github.com/users/kren1/repos","events_url":"https://api.github.com/users/kren1/events{/privacy}","received_events_url":"https://api.github.com/users/kren1/received_events","type":"User","site_admin":false},"repo":{"id":36978196,"name":"klee","full_name":"kren1/klee","owner":{"login":"kren1","id":310855,"avatar_url":"https://avatars.githubusercontent.com/u/310855?v=3","gravatar_id":"","url":"https://api.github.com/users/kren1","html_url":"https://github.com/kren1","followers_url":"https://api.github.com/users/kren1/followers","following_url":"https://api.github.com/users/kren1/following{/other_user}","gists_url":"https://api.github.com/users/kren1/gists{/gist_id}","starred_url":"https://api.github.com/users/kren1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kren1/subscriptions","organizations_url":"https://api.github.com/users/kren1/orgs","repos_url":"https://api.github.com/users/kren1/repos","events_url":"https://api.github.com/users/kren1/events{/privacy}","received_events_url":"https://api.github.com/users/kren1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kren1/klee","description":"KLEE Symbolic Virtual Machine","fork":true,"url":"https://api.github.com/repos/kren1/klee","forks_url":"https://api.github.com/repos/kren1/klee/forks","keys_url":"https://api.github.com/repos/kren1/klee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kren1/klee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kren1/klee/teams","hooks_url":"https://api.github.com/repos/kren1/klee/hooks","issue_events_url":"https://api.github.com/repos/kren1/klee/issues/events{/number}","events_url":"https://api.github.com/repos/kren1/klee/events","assignees_url":"https://api.github.com/repos/kren1/klee/assignees{/user}","branches_url":"https://api.github.com/repos/kren1/klee/branches{/branch}","tags_url":"https://api.github.com/repos/kren1/klee/tags","blobs_url":"https://api.github.com/repos/kren1/klee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kren1/klee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kren1/klee/git/refs{/sha}","trees_url":"https://api.github.com/repos/kren1/klee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kren1/klee/statuses/{sha}","languages_url":"https://api.github.com/repos/kren1/klee/languages","stargazers_url":"https://api.github.com/repos/kren1/klee/stargazers","contributors_url":"https://api.github.com/repos/kren1/klee/contributors","subscribers_url":"https://api.github.com/repos/kren1/klee/subscribers","subscription_url":"https://api.github.com/repos/kren1/klee/subscription","commits_url":"https://api.github.com/repos/kren1/klee/commits{/sha}","git_commits_url":"https://api.github.com/repos/kren1/klee/git/commits{/sha}","comments_url":"https://api.github.com/repos/kren1/klee/comments{/number}","issue_comment_url":"https://api.github.com/repos/kren1/klee/issues/comments{/number}","contents_url":"https://api.github.com/repos/kren1/klee/contents/{+path}","compare_url":"https://api.github.com/repos/kren1/klee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kren1/klee/merges","archive_url":"https://api.github.com/repos/kren1/klee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kren1/klee/downloads","issues_url":"https://api.github.com/repos/kren1/klee/issues{/number}","pulls_url":"https://api.github.com/repos/kren1/klee/pulls{/number}","milestones_url":"https://api.github.com/repos/kren1/klee/milestones{/number}","notifications_url":"https://api.github.com/repos/kren1/klee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kren1/klee/labels{/name}","releases_url":"https://api.github.com/repos/kren1/klee/releases{/id}","created_at":"2015-06-06T11:44:58Z","updated_at":"2015-06-06T11:44:59Z","pushed_at":"2015-08-10T11:58:14Z","git_url":"git://github.com/kren1/klee.git","ssh_url":"git@github.com:kren1/klee.git","clone_url":"https://github.com/kren1/klee.git","svn_url":"https://github.com/kren1/klee","homepage":"http://klee.llvm.org","size":4283,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"klee:master","ref":"master","sha":"5e70d1513641a315f981f409044d881cfd0f8ce6","user":{"login":"klee","id":6224192,"avatar_url":"https://avatars.githubusercontent.com/u/6224192?v=3","gravatar_id":"","url":"https://api.github.com/users/klee","html_url":"https://github.com/klee","followers_url":"https://api.github.com/users/klee/followers","following_url":"https://api.github.com/users/klee/following{/other_user}","gists_url":"https://api.github.com/users/klee/gists{/gist_id}","starred_url":"https://api.github.com/users/klee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klee/subscriptions","organizations_url":"https://api.github.com/users/klee/orgs","repos_url":"https://api.github.com/users/klee/repos","events_url":"https://api.github.com/users/klee/events{/privacy}","received_events_url":"https://api.github.com/users/klee/received_events","type":"Organization","site_admin":false},"repo":{"id":11568417,"name":"klee","full_name":"klee/klee","owner":{"login":"klee","id":6224192,"avatar_url":"https://avatars.githubusercontent.com/u/6224192?v=3","gravatar_id":"","url":"https://api.github.com/users/klee","html_url":"https://github.com/klee","followers_url":"https://api.github.com/users/klee/followers","following_url":"https://api.github.com/users/klee/following{/other_user}","gists_url":"https://api.github.com/users/klee/gists{/gist_id}","starred_url":"https://api.github.com/users/klee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klee/subscriptions","organizations_url":"https://api.github.com/users/klee/orgs","repos_url":"https://api.github.com/users/klee/repos","events_url":"https://api.github.com/users/klee/events{/privacy}","received_events_url":"https://api.github.com/users/klee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/klee/klee","description":"KLEE Symbolic Virtual Machine","fork":false,"url":"https://api.github.com/repos/klee/klee","forks_url":"https://api.github.com/repos/klee/klee/forks","keys_url":"https://api.github.com/repos/klee/klee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klee/klee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klee/klee/teams","hooks_url":"https://api.github.com/repos/klee/klee/hooks","issue_events_url":"https://api.github.com/repos/klee/klee/issues/events{/number}","events_url":"https://api.github.com/repos/klee/klee/events","assignees_url":"https://api.github.com/repos/klee/klee/assignees{/user}","branches_url":"https://api.github.com/repos/klee/klee/branches{/branch}","tags_url":"https://api.github.com/repos/klee/klee/tags","blobs_url":"https://api.github.com/repos/klee/klee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klee/klee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klee/klee/git/refs{/sha}","trees_url":"https://api.github.com/repos/klee/klee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klee/klee/statuses/{sha}","languages_url":"https://api.github.com/repos/klee/klee/languages","stargazers_url":"https://api.github.com/repos/klee/klee/stargazers","contributors_url":"https://api.github.com/repos/klee/klee/contributors","subscribers_url":"https://api.github.com/repos/klee/klee/subscribers","subscription_url":"https://api.github.com/repos/klee/klee/subscription","commits_url":"https://api.github.com/repos/klee/klee/commits{/sha}","git_commits_url":"https://api.github.com/repos/klee/klee/git/commits{/sha}","comments_url":"https://api.github.com/repos/klee/klee/comments{/number}","issue_comment_url":"https://api.github.com/repos/klee/klee/issues/comments{/number}","contents_url":"https://api.github.com/repos/klee/klee/contents/{+path}","compare_url":"https://api.github.com/repos/klee/klee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klee/klee/merges","archive_url":"https://api.github.com/repos/klee/klee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klee/klee/downloads","issues_url":"https://api.github.com/repos/klee/klee/issues{/number}","pulls_url":"https://api.github.com/repos/klee/klee/pulls{/number}","milestones_url":"https://api.github.com/repos/klee/klee/milestones{/number}","notifications_url":"https://api.github.com/repos/klee/klee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klee/klee/labels{/name}","releases_url":"https://api.github.com/repos/klee/klee/releases{/id}","created_at":"2013-07-21T22:03:03Z","updated_at":"2015-12-13T10:48:21Z","pushed_at":"2015-12-17T19:51:35Z","git_url":"git://github.com/klee/klee.git","ssh_url":"git@github.com:klee/klee.git","clone_url":"https://github.com/klee/klee.git","svn_url":"https://github.com/klee/klee","homepage":"http://klee.llvm.org","size":5186,"stargazers_count":281,"watchers_count":281,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":77,"forks":131,"open_issues":77,"watchers":281,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/klee/klee/pulls/246"},"html":{"href":"https://github.com/klee/klee/pull/246"},"issue":{"href":"https://api.github.com/repos/klee/klee/issues/246"},"comments":{"href":"https://api.github.com/repos/klee/klee/issues/246/comments"},"review_comments":{"href":"https://api.github.com/repos/klee/klee/pulls/246/comments"},"review_comment":{"href":"https://api.github.com/repos/klee/klee/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/klee/klee/pulls/246/commits"},"statuses":{"href":"https://api.github.com/repos/klee/klee/statuses/cb77cbb4841cec76b4bc19b6a8784b812c3034cd"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":3,"review_comments":0,"commits":1,"additions":25,"deletions":1,"changed_files":2}}