{"action":"opened","issue":{"url":"https://api.github.com/repos/nickg/nvc/issues/158","labels_url":"https://api.github.com/repos/nickg/nvc/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/nickg/nvc/issues/158/comments","events_url":"https://api.github.com/repos/nickg/nvc/issues/158/events","html_url":"https://github.com/nickg/nvc/issues/158","id":73235490,"number":158,"title":"Cannot return safety check. ","user":{"login":"kraigher","id":4018223,"avatar_url":"https://avatars.githubusercontent.com/u/4018223?v=3","gravatar_id":"","url":"https://api.github.com/users/kraigher","html_url":"https://github.com/kraigher","followers_url":"https://api.github.com/users/kraigher/followers","following_url":"https://api.github.com/users/kraigher/following{/other_user}","gists_url":"https://api.github.com/users/kraigher/gists{/gist_id}","starred_url":"https://api.github.com/users/kraigher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraigher/subscriptions","organizations_url":"https://api.github.com/users/kraigher/orgs","repos_url":"https://api.github.com/users/kraigher/repos","events_url":"https://api.github.com/users/kraigher/events{/privacy}","received_events_url":"https://api.github.com/users/kraigher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-05T07:25:29Z","updated_at":"2015-05-05T07:25:29Z","closed_at":null,"body":"```vhdl\r\npackage cannot_return_safety_check_pkg is\r\nend package cannot_return_safety_check_pkg;\r\n\r\npackage body cannot_return_safety_check_pkg is\r\n  type string_ptr is access string;\r\n  procedure proc(variable value : inout string_ptr) is\r\n  begin\r\n    value := new string'(\"buggy\");\r\n  end procedure;\r\n\r\n  impure function fun return string is\r\n    variable value : string_ptr;\r\n  begin\r\n    proc(value);\r\n    return value.all;\r\n  end;\r\nend package body;\r\n```\r\n\r\n```\r\n> nvc -a cannot_return_safety_check_pkg.vhd \r\n\r\nName       WORK.CANNOT_RETURN_SAFETY_CHECK_PKG.FUN$S\r\nKind       function\r\nContext    WORK.CANNOT_RETURN_SAFETY_CHECK_PKG-body\r\nBlocks     1\r\nRegisters  5\r\nTypes      5\r\nVariables  1\r\n  VALUE                                 // A<[*] : 0..183> \r\nResult     [*] : 0..183\r\nParameters 0\r\nBegin\r\n   0: r0 := null                        // A<[*] : 0..183> \r\n      VALUE := store r0\r\n      r1 := index VALUE                 // @<A<[*] : 0..183>> \r\n      fcall WORK.CANNOT_RETURN_SAFETY_CHECK_PKG.PROC$uWORK.CANNOT_RETURN_SAFETY_CHECK_PKG.STRING_PTR; r1\r\n      r2 := load VALUE                  // A<[*] : 0..183> \r\n      null check r2\r\n      r3 := all r2                      // @<[*] : 0..183> => [*] : 0..183 \r\n      r4 := load indirect r3            // [*] : 0..183 \r\n      return r4\r\n\r\n** Fatal: cannot return safety check r4\r\n\r\n-------- STACK TRACE --------\r\nnvc(show_stacktrace+0x31) [0x4156bf]\r\nnvc(fatal_trace+0xae) [0x41518b]\r\nnvc() [0x476092]\r\nnvc(emit_return+0xc0) [0x47dce5]\r\nnvc() [0x4706b6]\r\nnvc() [0x471f07]\r\nnvc() [0x4735f8]\r\nnvc() [0x47307a]\r\nnvc() [0x47424d]\r\nnvc(lower_unit+0xa5) [0x474376]\r\nnvc() [0x410b1e]\r\nnvc(main+0x1d3) [0x412157]\r\n/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fe4dae6fec5]\r\nnvc() [0x4104e9]\r\n-----------------------------\r\n```\r\n\r\nI also tried with `integer_ptr` instead of `string_ptr` and it did not cause failure."}}