{"action":"created","comment":{"url":"https://api.github.com/repos/csmith-project/creduce/pulls/comments/33645402","id":33645402,"diff_hunk":"@@ -343,17 +437,120 @@ bool EmptyStructToInt::isValidRecordDecl(const RecordDecl *RD)\n \n   const DeclContext *Ctx = dyn_cast<DeclContext>(CXXDef);\n   TransAssert(Ctx && \"Invalid DeclContext!\");\n+  int count = 0;\n   for (DeclContext::decl_iterator I = Ctx->decls_begin(),\n        E = Ctx->decls_end(); I != E; ++I) {\n+    if ((*I)->isReferenced())\n+        return false;","path":"clang_delta/EmptyStructToInt.cpp","position":130,"original_position":130,"commit_id":"678b596eb00eca6e729916dd2473cf45b3f91eb5","original_commit_id":"678b596eb00eca6e729916dd2473cf45b3f91eb5","user":{"login":"chenyang78","id":757430,"avatar_url":"https://avatars.githubusercontent.com/u/757430?v=3","gravatar_id":"","url":"https://api.github.com/users/chenyang78","html_url":"https://github.com/chenyang78","followers_url":"https://api.github.com/users/chenyang78/followers","following_url":"https://api.github.com/users/chenyang78/following{/other_user}","gists_url":"https://api.github.com/users/chenyang78/gists{/gist_id}","starred_url":"https://api.github.com/users/chenyang78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenyang78/subscriptions","organizations_url":"https://api.github.com/users/chenyang78/orgs","repos_url":"https://api.github.com/users/chenyang78/repos","events_url":"https://api.github.com/users/chenyang78/events{/privacy}","received_events_url":"https://api.github.com/users/chenyang78/received_events","type":"User","site_admin":false},"body":"On a second thought, this looks not correct. The reason is that implicity destructors can be referenced. For example, with the change, clang_delta failed to transform the code below:\r\n\r\n    struct S { int f; };\r\n    struct S s = {1};\r\n\r\nPerhapse we could change the code to:\r\n\r\n        if (!(*I)->isImplicit()) {\r\n          if ((*I)->isReferenced())\r\n            return false;\r\n          ++count;\r\n        }","created_at":"2015-07-01T03:22:07Z","updated_at":"2015-07-01T03:22:07Z","html_url":"https://github.com/csmith-project/creduce/pull/55#discussion_r33645402","pull_request_url":"https://api.github.com/repos/csmith-project/creduce/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/comments/33645402"},"html":{"href":"https://github.com/csmith-project/creduce/pull/55#discussion_r33645402"},"pull_request":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/csmith-project/creduce/pulls/55","id":37163728,"html_url":"https://github.com/csmith-project/creduce/pull/55","diff_url":"https://github.com/csmith-project/creduce/pull/55.diff","patch_url":"https://github.com/csmith-project/creduce/pull/55.patch","issue_url":"https://api.github.com/repos/csmith-project/creduce/issues/55","number":55,"state":"open","locked":false,"title":"Improved transformations on structs","user":{"login":"mpflanzer","id":520198,"avatar_url":"https://avatars.githubusercontent.com/u/520198?v=3","gravatar_id":"","url":"https://api.github.com/users/mpflanzer","html_url":"https://github.com/mpflanzer","followers_url":"https://api.github.com/users/mpflanzer/followers","following_url":"https://api.github.com/users/mpflanzer/following{/other_user}","gists_url":"https://api.github.com/users/mpflanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/mpflanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpflanzer/subscriptions","organizations_url":"https://api.github.com/users/mpflanzer/orgs","repos_url":"https://api.github.com/users/mpflanzer/repos","events_url":"https://api.github.com/users/mpflanzer/events{/privacy}","received_events_url":"https://api.github.com/users/mpflanzer/received_events","type":"User","site_admin":false},"body":"This pull request fixes an issue with the transformation remove-unused-field. When the last item of an initialiser list with a trailing comma had been removed the list was left only with the comma inside. While a trailing comma after the last element is allowed the list with only the comma is syntactically incorrect.\r\n\r\nFurther the transformation empty-struct-to-int is extended. This pull request changes the behaviour such that any initialiser list for the struct under change is replace with a zero constant to initialise the new int variable. Without these changes undefined behaviour is introduced in the case of an array, struct or union as last unused field in the struct under change. After the struct under change is turned into an int any variable with the old struct type would potentially be initialised with an initialiser list. But the C99 standard forbids this (Sec 6.7.8 §2): \"No initializer shall attempt to provide a value for an object not contained within the entity being initialized.\"\r\n\r\n**Example for old behaviour:**\r\nBefore transformation:\r\n```\r\nstruct S0 {\r\n   int a[5];\r\n}\r\n\r\nstruct S0 s = {{1,2,3,4,5}};\r\n```\r\nAfter transformation:\r\n```\r\nint s = {{1,2,3,4,5}};\r\n```\r\n\r\nWith the changes of the pull request it will be `int s = 0`;","created_at":"2015-06-08T15:14:23Z","updated_at":"2015-07-01T03:22:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b4c66cd88d28a6d08e7d3eaeeebacf7566e82d6","assignee":{"login":"chenyang78","id":757430,"avatar_url":"https://avatars.githubusercontent.com/u/757430?v=3","gravatar_id":"","url":"https://api.github.com/users/chenyang78","html_url":"https://github.com/chenyang78","followers_url":"https://api.github.com/users/chenyang78/followers","following_url":"https://api.github.com/users/chenyang78/following{/other_user}","gists_url":"https://api.github.com/users/chenyang78/gists{/gist_id}","starred_url":"https://api.github.com/users/chenyang78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenyang78/subscriptions","organizations_url":"https://api.github.com/users/chenyang78/orgs","repos_url":"https://api.github.com/users/chenyang78/repos","events_url":"https://api.github.com/users/chenyang78/events{/privacy}","received_events_url":"https://api.github.com/users/chenyang78/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/csmith-project/creduce/pulls/55/commits","review_comments_url":"https://api.github.com/repos/csmith-project/creduce/pulls/55/comments","review_comment_url":"https://api.github.com/repos/csmith-project/creduce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/csmith-project/creduce/issues/55/comments","statuses_url":"https://api.github.com/repos/csmith-project/creduce/statuses/678b596eb00eca6e729916dd2473cf45b3f91eb5","head":{"label":"mpflanzer:struct_init","ref":"struct_init","sha":"678b596eb00eca6e729916dd2473cf45b3f91eb5","user":{"login":"mpflanzer","id":520198,"avatar_url":"https://avatars.githubusercontent.com/u/520198?v=3","gravatar_id":"","url":"https://api.github.com/users/mpflanzer","html_url":"https://github.com/mpflanzer","followers_url":"https://api.github.com/users/mpflanzer/followers","following_url":"https://api.github.com/users/mpflanzer/following{/other_user}","gists_url":"https://api.github.com/users/mpflanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/mpflanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpflanzer/subscriptions","organizations_url":"https://api.github.com/users/mpflanzer/orgs","repos_url":"https://api.github.com/users/mpflanzer/repos","events_url":"https://api.github.com/users/mpflanzer/events{/privacy}","received_events_url":"https://api.github.com/users/mpflanzer/received_events","type":"User","site_admin":false},"repo":{"id":36359572,"name":"creduce","full_name":"mpflanzer/creduce","owner":{"login":"mpflanzer","id":520198,"avatar_url":"https://avatars.githubusercontent.com/u/520198?v=3","gravatar_id":"","url":"https://api.github.com/users/mpflanzer","html_url":"https://github.com/mpflanzer","followers_url":"https://api.github.com/users/mpflanzer/followers","following_url":"https://api.github.com/users/mpflanzer/following{/other_user}","gists_url":"https://api.github.com/users/mpflanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/mpflanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpflanzer/subscriptions","organizations_url":"https://api.github.com/users/mpflanzer/orgs","repos_url":"https://api.github.com/users/mpflanzer/repos","events_url":"https://api.github.com/users/mpflanzer/events{/privacy}","received_events_url":"https://api.github.com/users/mpflanzer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mpflanzer/creduce","description":"C-Reduce, a C program reducer","fork":true,"url":"https://api.github.com/repos/mpflanzer/creduce","forks_url":"https://api.github.com/repos/mpflanzer/creduce/forks","keys_url":"https://api.github.com/repos/mpflanzer/creduce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mpflanzer/creduce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mpflanzer/creduce/teams","hooks_url":"https://api.github.com/repos/mpflanzer/creduce/hooks","issue_events_url":"https://api.github.com/repos/mpflanzer/creduce/issues/events{/number}","events_url":"https://api.github.com/repos/mpflanzer/creduce/events","assignees_url":"https://api.github.com/repos/mpflanzer/creduce/assignees{/user}","branches_url":"https://api.github.com/repos/mpflanzer/creduce/branches{/branch}","tags_url":"https://api.github.com/repos/mpflanzer/creduce/tags","blobs_url":"https://api.github.com/repos/mpflanzer/creduce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mpflanzer/creduce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mpflanzer/creduce/git/refs{/sha}","trees_url":"https://api.github.com/repos/mpflanzer/creduce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mpflanzer/creduce/statuses/{sha}","languages_url":"https://api.github.com/repos/mpflanzer/creduce/languages","stargazers_url":"https://api.github.com/repos/mpflanzer/creduce/stargazers","contributors_url":"https://api.github.com/repos/mpflanzer/creduce/contributors","subscribers_url":"https://api.github.com/repos/mpflanzer/creduce/subscribers","subscription_url":"https://api.github.com/repos/mpflanzer/creduce/subscription","commits_url":"https://api.github.com/repos/mpflanzer/creduce/commits{/sha}","git_commits_url":"https://api.github.com/repos/mpflanzer/creduce/git/commits{/sha}","comments_url":"https://api.github.com/repos/mpflanzer/creduce/comments{/number}","issue_comment_url":"https://api.github.com/repos/mpflanzer/creduce/issues/comments{/number}","contents_url":"https://api.github.com/repos/mpflanzer/creduce/contents/{+path}","compare_url":"https://api.github.com/repos/mpflanzer/creduce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mpflanzer/creduce/merges","archive_url":"https://api.github.com/repos/mpflanzer/creduce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mpflanzer/creduce/downloads","issues_url":"https://api.github.com/repos/mpflanzer/creduce/issues{/number}","pulls_url":"https://api.github.com/repos/mpflanzer/creduce/pulls{/number}","milestones_url":"https://api.github.com/repos/mpflanzer/creduce/milestones{/number}","notifications_url":"https://api.github.com/repos/mpflanzer/creduce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mpflanzer/creduce/labels{/name}","releases_url":"https://api.github.com/repos/mpflanzer/creduce/releases{/id}","created_at":"2015-05-27T10:23:25Z","updated_at":"2015-05-31T10:44:57Z","pushed_at":"2015-06-15T14:54:46Z","git_url":"git://github.com/mpflanzer/creduce.git","ssh_url":"git@github.com:mpflanzer/creduce.git","clone_url":"https://github.com/mpflanzer/creduce.git","svn_url":"https://github.com/mpflanzer/creduce","homepage":"http://embed.cs.utah.edu/creduce/","size":3790,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"csmith-project:master","ref":"master","sha":"621e7c8553aaf57bd211319c6ed9e44d21e916fa","user":{"login":"csmith-project","id":757200,"avatar_url":"https://avatars.githubusercontent.com/u/757200?v=3","gravatar_id":"","url":"https://api.github.com/users/csmith-project","html_url":"https://github.com/csmith-project","followers_url":"https://api.github.com/users/csmith-project/followers","following_url":"https://api.github.com/users/csmith-project/following{/other_user}","gists_url":"https://api.github.com/users/csmith-project/gists{/gist_id}","starred_url":"https://api.github.com/users/csmith-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csmith-project/subscriptions","organizations_url":"https://api.github.com/users/csmith-project/orgs","repos_url":"https://api.github.com/users/csmith-project/repos","events_url":"https://api.github.com/users/csmith-project/events{/privacy}","received_events_url":"https://api.github.com/users/csmith-project/received_events","type":"Organization","site_admin":false},"repo":{"id":3572572,"name":"creduce","full_name":"csmith-project/creduce","owner":{"login":"csmith-project","id":757200,"avatar_url":"https://avatars.githubusercontent.com/u/757200?v=3","gravatar_id":"","url":"https://api.github.com/users/csmith-project","html_url":"https://github.com/csmith-project","followers_url":"https://api.github.com/users/csmith-project/followers","following_url":"https://api.github.com/users/csmith-project/following{/other_user}","gists_url":"https://api.github.com/users/csmith-project/gists{/gist_id}","starred_url":"https://api.github.com/users/csmith-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csmith-project/subscriptions","organizations_url":"https://api.github.com/users/csmith-project/orgs","repos_url":"https://api.github.com/users/csmith-project/repos","events_url":"https://api.github.com/users/csmith-project/events{/privacy}","received_events_url":"https://api.github.com/users/csmith-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/csmith-project/creduce","description":"C-Reduce, a C program reducer","fork":false,"url":"https://api.github.com/repos/csmith-project/creduce","forks_url":"https://api.github.com/repos/csmith-project/creduce/forks","keys_url":"https://api.github.com/repos/csmith-project/creduce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/csmith-project/creduce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/csmith-project/creduce/teams","hooks_url":"https://api.github.com/repos/csmith-project/creduce/hooks","issue_events_url":"https://api.github.com/repos/csmith-project/creduce/issues/events{/number}","events_url":"https://api.github.com/repos/csmith-project/creduce/events","assignees_url":"https://api.github.com/repos/csmith-project/creduce/assignees{/user}","branches_url":"https://api.github.com/repos/csmith-project/creduce/branches{/branch}","tags_url":"https://api.github.com/repos/csmith-project/creduce/tags","blobs_url":"https://api.github.com/repos/csmith-project/creduce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/csmith-project/creduce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/csmith-project/creduce/git/refs{/sha}","trees_url":"https://api.github.com/repos/csmith-project/creduce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/csmith-project/creduce/statuses/{sha}","languages_url":"https://api.github.com/repos/csmith-project/creduce/languages","stargazers_url":"https://api.github.com/repos/csmith-project/creduce/stargazers","contributors_url":"https://api.github.com/repos/csmith-project/creduce/contributors","subscribers_url":"https://api.github.com/repos/csmith-project/creduce/subscribers","subscription_url":"https://api.github.com/repos/csmith-project/creduce/subscription","commits_url":"https://api.github.com/repos/csmith-project/creduce/commits{/sha}","git_commits_url":"https://api.github.com/repos/csmith-project/creduce/git/commits{/sha}","comments_url":"https://api.github.com/repos/csmith-project/creduce/comments{/number}","issue_comment_url":"https://api.github.com/repos/csmith-project/creduce/issues/comments{/number}","contents_url":"https://api.github.com/repos/csmith-project/creduce/contents/{+path}","compare_url":"https://api.github.com/repos/csmith-project/creduce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/csmith-project/creduce/merges","archive_url":"https://api.github.com/repos/csmith-project/creduce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/csmith-project/creduce/downloads","issues_url":"https://api.github.com/repos/csmith-project/creduce/issues{/number}","pulls_url":"https://api.github.com/repos/csmith-project/creduce/pulls{/number}","milestones_url":"https://api.github.com/repos/csmith-project/creduce/milestones{/number}","notifications_url":"https://api.github.com/repos/csmith-project/creduce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/csmith-project/creduce/labels{/name}","releases_url":"https://api.github.com/repos/csmith-project/creduce/releases{/id}","created_at":"2012-02-28T15:55:07Z","updated_at":"2015-06-29T13:34:04Z","pushed_at":"2015-06-22T09:25:57Z","git_url":"git://github.com/csmith-project/creduce.git","ssh_url":"git@github.com:csmith-project/creduce.git","clone_url":"https://github.com/csmith-project/creduce.git","svn_url":"https://github.com/csmith-project/creduce","homepage":"http://embed.cs.utah.edu/creduce/","size":5235,"stargazers_count":266,"watchers_count":266,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":11,"forks":30,"open_issues":11,"watchers":266,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/55"},"html":{"href":"https://github.com/csmith-project/creduce/pull/55"},"issue":{"href":"https://api.github.com/repos/csmith-project/creduce/issues/55"},"comments":{"href":"https://api.github.com/repos/csmith-project/creduce/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/csmith-project/creduce/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/csmith-project/creduce/statuses/678b596eb00eca6e729916dd2473cf45b3f91eb5"}}}}