{"action":"closed","issue":{"url":"https://api.github.com/repos/fsharp/fsharp/issues/537","labels_url":"https://api.github.com/repos/fsharp/fsharp/issues/537/labels{/name}","comments_url":"https://api.github.com/repos/fsharp/fsharp/issues/537/comments","events_url":"https://api.github.com/repos/fsharp/fsharp/issues/537/events","html_url":"https://github.com/fsharp/fsharp/issues/537","id":130056879,"number":537,"title":"Stack Corruption in mono (where code is fine on Windows)","user":{"login":"dbwz8","id":10551465,"avatar_url":"https://avatars.githubusercontent.com/u/10551465?v=3","gravatar_id":"","url":"https://api.github.com/users/dbwz8","html_url":"https://github.com/dbwz8","followers_url":"https://api.github.com/users/dbwz8/followers","following_url":"https://api.github.com/users/dbwz8/following{/other_user}","gists_url":"https://api.github.com/users/dbwz8/gists{/gist_id}","starred_url":"https://api.github.com/users/dbwz8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbwz8/subscriptions","organizations_url":"https://api.github.com/users/dbwz8/orgs","repos_url":"https://api.github.com/users/dbwz8/repos","events_url":"https://api.github.com/users/dbwz8/events{/privacy}","received_events_url":"https://api.github.com/users/dbwz8/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-31T00:28:52Z","updated_at":"2016-01-31T00:38:46Z","closed_at":"2016-01-31T00:38:46Z","body":"If you take the following complete program and complie/run under mono on Ubuntu:\r\n```fsharp\r\nopen System\r\n\r\nlet  Bits (n:int) =\r\n    let rec look n cnt =\r\n        //printfn \"  ... %2d %2d\" n cnt\r\n        if n = 0 then cnt\r\n        else look (n>>>1) (cnt+1)\r\n    look n 0\r\n\r\n[<EntryPoint>]\r\nlet main argv =\r\n    for i in 0..7 do\r\n        let bits    =  Bits i\r\n        printfn \"%2d = %2d\" i bits\r\n    0\r\n```\r\nYou get:\r\n```\r\n0 =  0\r\n0\r\n* Assertion: should not be reached at tramp-amd64.c:396\r\n\r\nStacktrace:\r\n\r\n\r\nNative stacktrace:\r\n\r\n\tmono() [0x49cf0c]\r\n\t/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f82009c8340]\r\n\t/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39) [0x7f8200628bb9]\r\n\t/lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7f820062bfc8]\r\n\tmono() [0x62a329]\r\n\tmono() [0x62a537]\r\n\tmono() [0x62a686]\r\n\tmono() [0x4f368d]\r\n\t[0x4059c0ef]\r\n\r\nDebug info from gdb:\r\n\r\nCould not attach to process.  If your uid matches the uid of the target\r\nprocess, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\r\nagain as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf\r\nptrace: Operation not permitted.\r\nNo threads.\r\n\r\n=================================================================\r\nGot a SIGABRT while executing native code. This usually indicates\r\na fatal error in the mono runtime or one of the native libraries \r\nused by your application.\r\n=================================================================\r\n```\r\nIf you take the compiled executable (Test3.exe) and copy it over to Windows and try to run it, you get:\r\n```\r\n> Test3.exe\r\n 0 =  0\r\n 1 =  1\r\n 2 =  2\r\n 3 =  2\r\n 4 =  3\r\n 5 =  3\r\n 6 =  3\r\n 7 =  3\r\n```\r\nIf you stay on Linux under mono and just uncomment the ```printfn``` it also runs perfectly.\r\n."}}