{"action":"created","issue":{"url":"https://api.github.com/repos/numba/llvmlite/issues/298","repository_url":"https://api.github.com/repos/numba/llvmlite","labels_url":"https://api.github.com/repos/numba/llvmlite/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/numba/llvmlite/issues/298/comments","events_url":"https://api.github.com/repos/numba/llvmlite/issues/298/events","html_url":"https://github.com/numba/llvmlite/issues/298","id":255122884,"node_id":"MDU6SXNzdWUyNTUxMjI4ODQ=","number":298,"title":"indexing array types","user":{"login":"jvesely","id":5942874,"node_id":"MDQ6VXNlcjU5NDI4NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5942874?v=4","gravatar_id":"","url":"https://api.github.com/users/jvesely","html_url":"https://github.com/jvesely","followers_url":"https://api.github.com/users/jvesely/followers","following_url":"https://api.github.com/users/jvesely/following{/other_user}","gists_url":"https://api.github.com/users/jvesely/gists{/gist_id}","starred_url":"https://api.github.com/users/jvesely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvesely/subscriptions","organizations_url":"https://api.github.com/users/jvesely/orgs","repos_url":"https://api.github.com/users/jvesely/repos","events_url":"https://api.github.com/users/jvesely/events{/privacy}","received_events_url":"https://api.github.com/users/jvesely/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-09-04T22:12:22Z","updated_at":"2018-06-13T13:59:35Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI have a struct that includes an array. A simplified case looks like this:\r\n```\r\nfloat_ty = ir.DoubleType()\r\nnoise_ty = ir.ArrayType(float_ty, 10)\r\n# rate, offset, noise\r\nparam_type = ir.LiteralStructType([float_ty, float_ty, noise_ty])\r\n```\r\nusing constant indices works OK:\r\n```\r\nnoise = builder.extract_value(params, (2, 1))\r\n```\r\nhowever when I try to use dynamic index (like in a loop):\r\n```\r\nindex_ptr = builder.alloca(ir.IntType(32))\r\n... # store something to index_ptr\r\nindex = builder.load(index_ptr)\r\nnoise = builder.extract_value(params, (2, index))\r\n```\r\nI hit a python error:\r\n```\r\n    def __getitem__(self, item):\r\n>       if 0 <= item < self.size:\r\nE       TypeError: '<=' not supported between instances of 'int' and 'LoadInstr'\r\n```\r\nThe documentation for extract_value says that:\r\n> If agg is of an array type, indices can be arbitrary values."},"comment":{"url":"https://api.github.com/repos/numba/llvmlite/issues/comments/396947473","html_url":"https://github.com/numba/llvmlite/issues/298#issuecomment-396947473","issue_url":"https://api.github.com/repos/numba/llvmlite/issues/298","id":396947473,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Njk0NzQ3Mw==","user":{"login":"jvesely","id":5942874,"node_id":"MDQ6VXNlcjU5NDI4NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5942874?v=4","gravatar_id":"","url":"https://api.github.com/users/jvesely","html_url":"https://github.com/jvesely","followers_url":"https://api.github.com/users/jvesely/followers","following_url":"https://api.github.com/users/jvesely/following{/other_user}","gists_url":"https://api.github.com/users/jvesely/gists{/gist_id}","starred_url":"https://api.github.com/users/jvesely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvesely/subscriptions","organizations_url":"https://api.github.com/users/jvesely/orgs","repos_url":"https://api.github.com/users/jvesely/repos","events_url":"https://api.github.com/users/jvesely/events{/privacy}","received_events_url":"https://api.github.com/users/jvesely/received_events","type":"User","site_admin":false},"created_at":"2018-06-13T13:59:35Z","updated_at":"2018-06-13T13:59:35Z","author_association":"NONE","body":"thanks. feel free to close this issue when the docs update lands."}}
{"actor":{"display_login":"jvesely"}}