{"action":"created","issue":{"url":"https://api.github.com/repos/riscv/riscv-gcc/issues/97","repository_url":"https://api.github.com/repos/riscv/riscv-gcc","labels_url":"https://api.github.com/repos/riscv/riscv-gcc/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/riscv/riscv-gcc/issues/97/comments","events_url":"https://api.github.com/repos/riscv/riscv-gcc/issues/97/events","html_url":"https://github.com/riscv/riscv-gcc/issues/97","id":260018366,"number":97,"title":"Bug: Invalid RV32C Instruction","user":{"login":"coldney","id":6134704,"avatar_url":"https://avatars3.githubusercontent.com/u/6134704?v=4","gravatar_id":"","url":"https://api.github.com/users/coldney","html_url":"https://github.com/coldney","followers_url":"https://api.github.com/users/coldney/followers","following_url":"https://api.github.com/users/coldney/following{/other_user}","gists_url":"https://api.github.com/users/coldney/gists{/gist_id}","starred_url":"https://api.github.com/users/coldney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coldney/subscriptions","organizations_url":"https://api.github.com/users/coldney/orgs","repos_url":"https://api.github.com/users/coldney/repos","events_url":"https://api.github.com/users/coldney/events{/privacy}","received_events_url":"https://api.github.com/users/coldney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-09-23T16:11:43Z","updated_at":"2017-09-24T16:22:25Z","closed_at":null,"author_association":"NONE","body":"When I compile the code like this:\r\n\r\n.c\r\n```\r\nextern u32 __text_size;\r\n__attribute__((noinline))\r\nvoid test(int n1, int n3)\r\n{\r\n    asm(\"nop\");\r\n}\r\n\r\nAT(.init_text)\r\nint main(void)\r\n{\r\n    test(0, (u32)&__text_size); \r\n    return 0;\r\n}\r\n```\r\n.ld:\r\n`__text_size= SIZEOF(.comm);`\r\n\r\nthe disassembly listing looks like:\r\n\r\n```\r\n10000012 <main>:\r\n10000012:\t6581                \tlui\ta1,0x0\r\n10000014:\t1171                \taddi\tsp,sp,-4\r\n10000016:\t4501                \tli\ta0,0\r\n10000018:\t60000593          \tli\ta1,1536\r\n1000001c:\tc006                \tsw\tra,0(sp)\r\n1000001e:\tf0020317          \tauipc\tt1,0xf0020\r\n10000022:\t1a0300e7          \tjalr\t416(t1) # 201be <test>\r\n10000026:\t4082                \tlw\tra,0(sp)\r\n10000028:\t4501                \tli\ta0,0\r\n1000002a:\t0111                \taddi\tsp,sp,4\r\n1000002c:\t8082                \tret\r\n```\r\n\r\nNotice the first instruction:\r\n`lui\ta1,0x0`\r\n\r\nin the RISCV-SPEC:\r\n\r\n> C.LUI is only valid when rd6={x0 , x2}, and when the immediate is not equal to zero. \r\n\r\nSo, it's an invalid instruction.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/riscv/riscv-gcc/issues/comments/331720787","html_url":"https://github.com/riscv/riscv-gcc/issues/97#issuecomment-331720787","issue_url":"https://api.github.com/repos/riscv/riscv-gcc/issues/97","id":331720787,"user":{"login":"coldney","id":6134704,"avatar_url":"https://avatars3.githubusercontent.com/u/6134704?v=4","gravatar_id":"","url":"https://api.github.com/users/coldney","html_url":"https://github.com/coldney","followers_url":"https://api.github.com/users/coldney/followers","following_url":"https://api.github.com/users/coldney/following{/other_user}","gists_url":"https://api.github.com/users/coldney/gists{/gist_id}","starred_url":"https://api.github.com/users/coldney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coldney/subscriptions","organizations_url":"https://api.github.com/users/coldney/orgs","repos_url":"https://api.github.com/users/coldney/repos","events_url":"https://api.github.com/users/coldney/events{/privacy}","received_events_url":"https://api.github.com/users/coldney/received_events","type":"User","site_admin":false},"created_at":"2017-09-24T16:22:25Z","updated_at":"2017-09-24T16:22:25Z","author_association":"NONE","body":"https://gist.github.com/coldney/1860ec279fde1791dc4518dde05ddc59"}}
{"actor":{"display_login":"coldney"}}