{"action":"created","issue":{"url":"https://api.github.com/repos/SVF-tools/SVF/issues/83","repository_url":"https://api.github.com/repos/SVF-tools/SVF","labels_url":"https://api.github.com/repos/SVF-tools/SVF/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/SVF-tools/SVF/issues/83/comments","events_url":"https://api.github.com/repos/SVF-tools/SVF/issues/83/events","html_url":"https://github.com/SVF-tools/SVF/issues/83","id":349329217,"node_id":"MDU6SXNzdWUzNDkzMjkyMTc=","number":83,"title":"Can IntraDirSVFGEdge having srcNode and dstNode from different functions?","user":{"login":"Machiry","id":1218510,"node_id":"MDQ6VXNlcjEyMTg1MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1218510?v=4","gravatar_id":"","url":"https://api.github.com/users/Machiry","html_url":"https://github.com/Machiry","followers_url":"https://api.github.com/users/Machiry/followers","following_url":"https://api.github.com/users/Machiry/following{/other_user}","gists_url":"https://api.github.com/users/Machiry/gists{/gist_id}","starred_url":"https://api.github.com/users/Machiry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machiry/subscriptions","organizations_url":"https://api.github.com/users/Machiry/orgs","repos_url":"https://api.github.com/users/Machiry/repos","events_url":"https://api.github.com/users/Machiry/events{/privacy}","received_events_url":"https://api.github.com/users/Machiry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-08-09T23:48:07Z","updated_at":"2018-08-10T05:45:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi @yuleisui,\r\n\r\nI am facing an issue where an `IntraDirSVFGEdge` has the src node (`getSrcNode` ) and dst node (`getDstNode` ) belong to **different functions**. \r\n\r\nHowever, by definition *Intra* edges should only connect nodes that belong to the same function.\r\n\r\nCan this happen? If yes, could you please describe what does this mean? Why do we need to make it an IntraDir edge?"},"comment":{"url":"https://api.github.com/repos/SVF-tools/SVF/issues/comments/411981746","html_url":"https://github.com/SVF-tools/SVF/issues/83#issuecomment-411981746","issue_url":"https://api.github.com/repos/SVF-tools/SVF/issues/83","id":411981746,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTk4MTc0Ng==","user":{"login":"Machiry","id":1218510,"node_id":"MDQ6VXNlcjEyMTg1MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1218510?v=4","gravatar_id":"","url":"https://api.github.com/users/Machiry","html_url":"https://github.com/Machiry","followers_url":"https://api.github.com/users/Machiry/followers","following_url":"https://api.github.com/users/Machiry/following{/other_user}","gists_url":"https://api.github.com/users/Machiry/gists{/gist_id}","starred_url":"https://api.github.com/users/Machiry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Machiry/subscriptions","organizations_url":"https://api.github.com/users/Machiry/orgs","repos_url":"https://api.github.com/users/Machiry/repos","events_url":"https://api.github.com/users/Machiry/events{/privacy}","received_events_url":"https://api.github.com/users/Machiry/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T05:45:33Z","updated_at":"2018-08-10T05:45:33Z","author_association":"CONTRIBUTOR","body":"I found the root cause:\r\n\r\nIn https://github.com/SVF-tools/SVF/blob/ee23492712f8ca1de1d879f873e9a5ad61f5fdff/lib/MSSA/SVFG.cpp#L287\r\n\r\n```\r\nif(const StmtSVFGNode* stmtNode = dyn_cast<StmtSVFGNode>(node)) {\r\n            if(isa<AddrSVFGNode>(stmtNode))\r\n                continue;\r\n            addIntraDirectVFEdge(getDef(stmtNode->getPAGSrcNode()),nodeId);\r\n\r\n           \r\n            if(isa<StoreSVFGNode>(stmtNode)) {\r\n              // HERE: getDef gets the SVFG node that belongs to different function and we end up adding Intra edge rather than Inter\r\n                addIntraDirectVFEdge(getDef(stmtNode->getPAGDstNode()),nodeId);\r\n            }\r\n\r\n        }\r\n```\r\n\r\nIf the `getDef(stmtNode->getPAGDstNode())` belongs to different function, shouldn't we add `IndirectSVFGEdge`? I am not sure, if this is the correct fix.\r\n\r\nTo reproduce this isse:\r\n\r\nAdd this:\r\n```\r\nif(srcNode->getBB() != nullptr && dstNode->getBB() != nullptr) {\r\n        assert(srcNode->getBB()->getParent() == dstNode->getBB()->getParent());\r\n    }\r\n```\r\nBefore this line: https://github.com/SVF-tools/SVF/blob/ee23492712f8ca1de1d879f873e9a5ad61f5fdff/lib/MSSA/SVFG.cpp#L541"}}
{"actor":{"display_login":"Machiry"}}