{"action":"created","issue":{"url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/106","labels_url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/106/comments","events_url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/106/events","html_url":"https://github.com/clash-lang/clash-compiler/issues/106","id":123732507,"number":106,"title":"Exponent literals cause Clash not to terminate","user":{"login":"wyager","id":780134,"avatar_url":"https://avatars.githubusercontent.com/u/780134?v=3","gravatar_id":"","url":"https://api.github.com/users/wyager","html_url":"https://github.com/wyager","followers_url":"https://api.github.com/users/wyager/followers","following_url":"https://api.github.com/users/wyager/following{/other_user}","gists_url":"https://api.github.com/users/wyager/gists{/gist_id}","starred_url":"https://api.github.com/users/wyager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyager/subscriptions","organizations_url":"https://api.github.com/users/wyager/orgs","repos_url":"https://api.github.com/users/wyager/repos","events_url":"https://api.github.com/users/wyager/events{/privacy}","received_events_url":"https://api.github.com/users/wyager/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-23T22:39:42Z","updated_at":"2015-12-23T23:03:06Z","closed_at":null,"body":"Take a look at https://github.com/wyager/HaSKI/commit/a7bfee53128e55660a6a27f0b230bbe5c55bfbd0\r\n\r\nThose `0x...` literals used to be `2^20` and `2^21`. Looks like clash got stuck in a loop of trying to inline `step2` and `default_...` until I changed them to hex literals."},"comment":{"url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/comments/167005946","html_url":"https://github.com/clash-lang/clash-compiler/issues/106#issuecomment-167005946","issue_url":"https://api.github.com/repos/clash-lang/clash-compiler/issues/106","id":167005946,"user":{"login":"comonoidial","id":14928502,"avatar_url":"https://avatars.githubusercontent.com/u/14928502?v=3","gravatar_id":"","url":"https://api.github.com/users/comonoidial","html_url":"https://github.com/comonoidial","followers_url":"https://api.github.com/users/comonoidial/followers","following_url":"https://api.github.com/users/comonoidial/following{/other_user}","gists_url":"https://api.github.com/users/comonoidial/gists{/gist_id}","starred_url":"https://api.github.com/users/comonoidial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/comonoidial/subscriptions","organizations_url":"https://api.github.com/users/comonoidial/orgs","repos_url":"https://api.github.com/users/comonoidial/repos","events_url":"https://api.github.com/users/comonoidial/events{/privacy}","received_events_url":"https://api.github.com/users/comonoidial/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T23:03:06Z","updated_at":"2015-12-23T23:03:06Z","body":"I guess the problem here is that the unspecialized version of (^) is used, as defined by ghc:\r\n```haskell\r\n(^) :: (Num a, Integral b) => a -> b -> a\r\nx0 ^ y0 | y0 < 0    = error \"Negative exponent\"\r\n        | y0 == 0   = 1\r\n        | otherwise = f x0 y0\r\n    where -- f : x0 ^ y0 = x ^ y\r\n          f x y | even y    = f (x * x) (y `quot` 2)\r\n                | y == 1    = x\r\n                | otherwise = g (x * x) ((y - 1) `quot` 2) x\r\n          -- g : x0 ^ y0 = (x ^ y) * z\r\n          g x y z | even y = g (x * x) (y `quot` 2) z\r\n                  | y == 1 = x * z\r\n                  | otherwise = g (x * x) ((y - 1) `quot` 2) (x * z)\r\n````\r\nThis seems quite a nasty recursive structure to eliminate by inlining."}}