{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/2286","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/2286/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/2286/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/2286/events","html_url":"https://github.com/dotnet/coreclr/issues/2286","id":121364093,"number":2286,"title":"RyuJIT may violate the CLR memory model during CSE","user":{"login":"pgavlin","id":1224093,"avatar_url":"https://avatars.githubusercontent.com/u/1224093?v=3","gravatar_id":"","url":"https://api.github.com/users/pgavlin","html_url":"https://github.com/pgavlin","followers_url":"https://api.github.com/users/pgavlin/followers","following_url":"https://api.github.com/users/pgavlin/following{/other_user}","gists_url":"https://api.github.com/users/pgavlin/gists{/gist_id}","starred_url":"https://api.github.com/users/pgavlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgavlin/subscriptions","organizations_url":"https://api.github.com/users/pgavlin/orgs","repos_url":"https://api.github.com/users/pgavlin/repos","events_url":"https://api.github.com/users/pgavlin/events{/privacy}","received_events_url":"https://api.github.com/users/pgavlin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/coreclr/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/coreclr/labels/CodeGen","name":"CodeGen","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"briansull","id":11621884,"avatar_url":"https://avatars.githubusercontent.com/u/11621884?v=3","gravatar_id":"","url":"https://api.github.com/users/briansull","html_url":"https://github.com/briansull","followers_url":"https://api.github.com/users/briansull/followers","following_url":"https://api.github.com/users/briansull/following{/other_user}","gists_url":"https://api.github.com/users/briansull/gists{/gist_id}","starred_url":"https://api.github.com/users/briansull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansull/subscriptions","organizations_url":"https://api.github.com/users/briansull/orgs","repos_url":"https://api.github.com/users/briansull/repos","events_url":"https://api.github.com/users/briansull/events{/privacy}","received_events_url":"https://api.github.com/users/briansull/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/coreclr/milestones/6","html_url":"https://github.com/dotnet/coreclr/milestones/1.0.0-rc2%20","labels_url":"https://api.github.com/repos/dotnet/coreclr/milestones/6/labels","id":1380513,"number":6,"title":"1.0.0-rc2 ","description":"","creator":{"login":"tzwlai","id":9966807,"avatar_url":"https://avatars.githubusercontent.com/u/9966807?v=3","gravatar_id":"","url":"https://api.github.com/users/tzwlai","html_url":"https://github.com/tzwlai","followers_url":"https://api.github.com/users/tzwlai/followers","following_url":"https://api.github.com/users/tzwlai/following{/other_user}","gists_url":"https://api.github.com/users/tzwlai/gists{/gist_id}","starred_url":"https://api.github.com/users/tzwlai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzwlai/subscriptions","organizations_url":"https://api.github.com/users/tzwlai/orgs","repos_url":"https://api.github.com/users/tzwlai/repos","events_url":"https://api.github.com/users/tzwlai/events{/privacy}","received_events_url":"https://api.github.com/users/tzwlai/received_events","type":"User","site_admin":false},"open_issues":101,"closed_issues":63,"state":"open","created_at":"2015-10-27T22:42:35Z","updated_at":"2016-01-12T18:14:53Z","due_on":"2016-02-02T08:00:00Z","closed_at":null},"comments":3,"created_at":"2015-12-09T23:19:05Z","updated_at":"2016-01-12T18:14:53Z","closed_at":"2016-01-12T18:14:53Z","body":"Test `JIT\\Regression\\CLR-x86-JIT\\V1-M13-RTM\\b99969` attempts to validate that the JIT does not improperly CSE array accesses across volatile memory operations. In particular, in the fragment below (which is a distillation of the aforementioned test), the second access of `arr[_index]` should not be CSE'd with the first, as doing so moves the read of `_index` above the read of `_flag`, thus violating the memory model.\r\n\r\n```\r\nsealed class C\r\n{\r\n    public int _index = 0;\r\n    private volatile bool _flag = false;\r\n\r\n    void M()\r\n    {\r\n        var arr = new int[1];\r\n\r\n        int result = 0;\r\n        result += arr[_index];\r\n\r\n        while (!_flag);\r\n        result += arr[_index];\r\n    }\r\n}\r\n```"}}