{"action":"created","issue":{"url":"https://api.github.com/repos/vishaps/voc/issues/52","repository_url":"https://api.github.com/repos/vishaps/voc","labels_url":"https://api.github.com/repos/vishaps/voc/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/vishaps/voc/issues/52/comments","events_url":"https://api.github.com/repos/vishaps/voc/issues/52/events","html_url":"https://github.com/vishaps/voc/issues/52","id":192599434,"number":52,"title":"problem with memory in case of nested functions?","user":{"login":"norayr","id":11881650,"avatar_url":"https://avatars.githubusercontent.com/u/11881650?v=3","gravatar_id":"","url":"https://api.github.com/users/norayr","html_url":"https://github.com/norayr","followers_url":"https://api.github.com/users/norayr/followers","following_url":"https://api.github.com/users/norayr/following{/other_user}","gists_url":"https://api.github.com/users/norayr/gists{/gist_id}","starred_url":"https://api.github.com/users/norayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norayr/subscriptions","organizations_url":"https://api.github.com/users/norayr/orgs","repos_url":"https://api.github.com/users/norayr/repos","events_url":"https://api.github.com/users/norayr/events{/privacy}","received_events_url":"https://api.github.com/users/norayr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-30T15:43:06Z","updated_at":"2016-12-02T15:12:22Z","closed_at":"2016-12-02T15:12:22Z","body":"procedure ulmPrint.Out gets parameter 'nargs'.\r\n\r\nWhen function gets called via ulmWrite.Int, 'nargs' argument receives 2, it's visible in debugger upon entering the function.\r\n\r\nThen the generated code looks like this:\r\n\r\n```\r\nstruct Out__12 _s;\r\n_s.out = &out;\r\n_s.fmt = (void*)fmt; _s.fmt__len = fmt__len;\r\n_s.nargs = &nargs;\r\n_s.p1 = (void*)p1; _s.p1__len = p1__len;\r\n```\r\n\r\nOut__12 _s is used by compiler for implementing nested functions.\r\nThen, when we enter SetSize nested function, ```*Out__12_s->nargs``` is some very big number, in the case right now 17179869186. That's why,\r\n\r\n```\r\nWHILE index < nargs DO\r\n```\r\nin SetSize function which looks like\r\n\r\n```\r\nstatic void SetSize__65 (void)\r\n{\r\n        INT32 index;\r\n        index = 0;\r\n        while (index < *Out__12_s->nargs) {\r\n                switch (index) {\r\n```\r\n\r\ngoes to the long loop.\r\n\r\nBy the way,  the CASE statement was not compiled, there was a warning 307 (no ELSE symbol after CASE statement sequence may lead to trap) and then compiler was stopping, by saying 'assertion failed'. Unless I've changed case sequence by adding ELSE before closing END.\r\n\r\nMemory model I am trying to use is default, -O2."},"comment":{"url":"https://api.github.com/repos/vishaps/voc/issues/comments/264476225","html_url":"https://github.com/vishaps/voc/issues/52#issuecomment-264476225","issue_url":"https://api.github.com/repos/vishaps/voc/issues/52","id":264476225,"user":{"login":"norayr","id":11881650,"avatar_url":"https://avatars.githubusercontent.com/u/11881650?v=3","gravatar_id":"","url":"https://api.github.com/users/norayr","html_url":"https://github.com/norayr","followers_url":"https://api.github.com/users/norayr/followers","following_url":"https://api.github.com/users/norayr/following{/other_user}","gists_url":"https://api.github.com/users/norayr/gists{/gist_id}","starred_url":"https://api.github.com/users/norayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norayr/subscriptions","organizations_url":"https://api.github.com/users/norayr/orgs","repos_url":"https://api.github.com/users/norayr/repos","events_url":"https://api.github.com/users/norayr/events{/privacy}","received_events_url":"https://api.github.com/users/norayr/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T15:12:22Z","updated_at":"2016-12-02T15:12:22Z","body":"yes! thank you! now *Out__12_s->nargs is '2' as well, and the while loop exists correctly."}}
{"actor":{"display_login":"norayr"}}