{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/20583","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/20583/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/20583/comments","events_url":"https://api.github.com/repos/golang/go/issues/20583/events","html_url":"https://github.com/golang/go/issues/20583","id":233700879,"number":20583,"title":"go/types: 'multiplication of zero with infinity' panic  on 6e886451608i/2 literal","user":{"login":"ALTree","id":3586803,"avatar_url":"https://avatars2.githubusercontent.com/u/3586803?v=4","gravatar_id":"","url":"https://api.github.com/users/ALTree","html_url":"https://github.com/ALTree","followers_url":"https://api.github.com/users/ALTree/followers","following_url":"https://api.github.com/users/ALTree/following{/other_user}","gists_url":"https://api.github.com/users/ALTree/gists{/gist_id}","starred_url":"https://api.github.com/users/ALTree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ALTree/subscriptions","organizations_url":"https://api.github.com/users/ALTree/orgs","repos_url":"https://api.github.com/users/ALTree/repos","events_url":"https://api.github.com/users/ALTree/events{/privacy}","received_events_url":"https://api.github.com/users/ALTree/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/56","html_url":"https://github.com/golang/go/milestone/56","labels_url":"https://api.github.com/repos/golang/go/milestones/56/labels","id":2473074,"number":56,"title":"Go1.10","description":"","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":814,"closed_issues":463,"state":"open","created_at":"2017-04-21T19:22:29Z","updated_at":"2017-11-07T00:06:06Z","due_on":"2018-01-31T08:00:00Z","closed_at":null},"comments":2,"created_at":"2017-06-05T20:28:08Z","updated_at":"2017-11-07T00:22:03Z","closed_at":null,"author_association":"MEMBER","body":"Found by @josharian with go-fuzz and factored out from #20227 since it has a different root cause.\r\n\r\nThe following:\r\n\r\n```\r\nvar g = 6e886451608i/2 \r\n```\r\n\r\nworks in `compile`:\r\n\r\n```\r\ntmp/sandbox861754843/main.go:3: constant too large: 6e886451608\r\n```\r\n\r\nbut crashes `go/types`:\r\n\r\n```\r\npanic: multiplication of zero with infinity [recovered]\r\n\tpanic: multiplication of zero with infinity [recovered]\r\n\tpanic: multiplication of zero with infinity\r\n\r\ngoroutine 5 [running]:\r\ntesting.tRunner.func1(0xc4200de0f0)\r\n\t/Users/josh/go/tip/src/testing/testing.go:712 +0x256\r\npanic(0x12b77e0, 0xc42004e9b0)\r\n\t/Users/josh/go/tip/src/runtime/panic.go:489 +0x259\r\ngo/types.(*Checker).handleBailout(0xc4200e0000, 0xc420073d08)\r\n\t/Users/josh/go/tip/src/go/types/check.go:225 +0xa4\r\npanic(0x12b77e0, 0xc42004e9b0)\r\n\t/Users/josh/go/tip/src/runtime/panic.go:489 +0x259\r\nmath/big.(*Float).Mul(0xc42000eed0, 0xc42000ee40, 0xc42000eea0, 0x13336f8)\r\n\t/Users/josh/go/tip/src/math/big/float.go:1581 +0x11b\r\ngo/constant.BinaryOp(0x146a7a0, 0xc42000ee40, 0xe, 0x146a7e0, 0x13336f8, 0x146a7e0, 0x14a5e20)\r\n\t/Users/josh/go/tip/src/go/constant/value.go:1056 +0x360\r\ngo/constant.mul(0x146a7a0, 0xc42000ee40, 0x146a7e0, 0x13336f8, 0x146a7e0, 0x14a5e20)\r\n\t/Users/josh/go/tip/src/go/constant/value.go:1116 +0x52\r\ngo/constant.BinaryOp(0x146a760, 0xc42000a4a0, 0xf, 0x146a7e0, 0xc420014478, 0x1170100, 0x1469a20)\r\n\t/Users/josh/go/tip/src/go/constant/value.go:1089 +0x1363\r\ngo/types.(*Checker).binary(0xc4200e0000, 0xc420058c40, 0xc42000ec30, 0x1469520, 0xc42000a320, 0x1469520, 0xc42000a340, 0xf)\r\n\t/Users/josh/go/tip/src/go/types/expr.go:817 +0x510\r\ngo/types.(*Checker).exprInternal(0xc4200e0000, 0xc420058c40, 0x1469560, 0xc42000ec30, 0x0, 0x0, 0xc42000a420)\r\n\t/Users/josh/go/tip/src/go/types/expr.go:1409 +0x1d64\r\ngo/types.(*Checker).rawExpr(0xc4200e0000, 0xc420058c40, 0x1469560, 0xc42000ec30, 0x0, 0x0, 0x0)\r\n\t/Users/josh/go/tip/src/go/types/expr.go:945 +0x81\r\ngo/types.(*Checker).multiExpr(0xc4200e0000, 0xc420058c40, 0x1469560, 0xc42000ec30)\r\n\t/Users/josh/go/tip/src/go/types/expr.go:1481 +0x62\r\ngo/types.(*Checker).expr(0xc4200e0000, 0xc420058c40, 0x1469560, 0xc42000ec30)\r\n\t/Users/josh/go/tip/src/go/types/expr.go:1475 +0x49\r\ngo/types.(*Checker).varDecl(0xc4200e0000, 0xc420085810, 0xc42000c0b0, 0x1, 0x1, 0x0, 0x0, 0x1469560, 0xc42000ec30)\r\n\t/Users/josh/go/tip/src/go/types/decl.go:166 +0x27c\r\ngo/types.(*Checker).objDecl(0xc4200e0000, 0x146c2c0, 0xc420085810, 0x0, 0xc420073c50, 0x0, 0x8)\r\n\t/Users/josh/go/tip/src/go/types/decl.go:81 +0x223\r\ngo/types.(*Checker).packageObjects(0xc4200e0000, 0xc42000a460, 0x2, 0x2)\r\n\t/Users/josh/go/tip/src/go/types/resolver.go:457 +0x105\r\ngo/types.(*Checker).checkFiles(0xc4200e0000, 0xc420073e30, 0x1, 0x1, 0x0, 0x0)\r\n\t/Users/josh/go/tip/src/go/types/check.go:239 +0xdb\r\ngo/types.(*Checker).Files(0xc4200e0000, 0xc420073e30, 0x1, 0x1, 0xc42000ede0, 0x0)\r\n\t/Users/josh/go/tip/src/go/types/check.go:230 +0x49\r\ngo/types.(*Config).Check(0xc420058c00, 0x12f539e, 0x1, 0xc420058b40, 0xc420073e30, 0x1, 0x1, 0xc4200856d0, 0x0, 0x2, ...)\r\n\t/Users/josh/go/tip/src/go/types/api.go:351 +0x1b3\r\ngo/types_test.TestIssue16902(0xc4200de0f0)\r\n\t/Users/josh/go/tip/src/go/types/sizes_test.go:106 +0x31f\r\ntesting.tRunner(0xc4200de0f0, 0x130bd20)\r\n\t/Users/josh/go/tip/src/testing/testing.go:747 +0xd0\r\ncreated by testing.(*T).Run\r\n\t/Users/josh/go/tip/src/testing/testing.go:789 +0x2de\r\nexit status 2\r\nFAIL\tgo/types\t0.011s\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/342333144","html_url":"https://github.com/golang/go/issues/20583#issuecomment-342333144","issue_url":"https://api.github.com/repos/golang/go/issues/20583","id":342333144,"user":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars2.githubusercontent.com/u/8528975?v=4","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"created_at":"2017-11-07T00:22:03Z","updated_at":"2017-11-07T00:22:03Z","author_association":"CONTRIBUTOR","body":"Here's another example:\r\n```\r\npackage p\r\n\r\nconst x = 1e600000000\r\nconst _ = x*0    // ok\r\nconst _ = x*x*0  // not ok\r\n```\r\nwhere the product x*x leads to an infinity internally. A correct solution really needs to recognize any kind of overflow to infinity.\r\n\r\nConcretely, in go/constant/value.go, we need to recognize these cases in the internal constructor functions (makeRat, makeFloat, etc.) and (probably) return an unknownVal if we have overflow. Generally unknown vals are \"silent\" but in these cases we need to also report an error. Ideally, the existing functions returned an error, but that sail has shipped. We could have \"signaling unknown vals\" and quiet ones (with a signaling one becoming quiet after first use).\r\n\r\nI'm going to assign this to me for now. Still thinking..."}}
{"actor":{"display_login":"griesemer"}}