Closed lum1n0us closed 3 years ago
This is invalid because the constant expression is referring to a mutable global. That's never legal.
yeah, but I also notice there is no such description in either latest spec(https://webassembly.github.io/spec/core/index.html) or the spec of reference type(https://webassembly.github.io/reference-types/core/).
It's in the definition of constant expressions: https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions
I mean the restriction about mutable imported globals can not be used in constant expressions. It just said "contained global.get instructions are only allowed to refer to imported globals".
From: Andreas Rossberg notifications@github.com Sent: Wednesday, February 24, 2021 3:40 PM To: WebAssembly/reference-types reference-types@noreply.github.com Cc: He, Liang liang.he@intel.com; Author author@noreply.github.com Subject: Re: [WebAssembly/reference-types] Constant Expressions constraint (#134)
It's in the definition of constant expressions: https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/WebAssembly/reference-types/issues/134#issuecomment-784865248, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO2CJMP4BMNJO4W7IZX6QDDTASUN7ANCNFSM4YBWKO2A.
Please look at the section I just linked, it says that the type of a global used in a const expression must be const.
OK, you got me. You are right. Thanks.
From: Andreas Rossberg notifications@github.com Sent: Wednesday, February 24, 2021 4:05 PM To: WebAssembly/reference-types reference-types@noreply.github.com Cc: He, Liang liang.he@intel.com; Author author@noreply.github.com Subject: Re: [WebAssembly/reference-types] Constant Expressions constraint (#134)
Please look at the section I just linked, it says that the type of a global used in a const expression must be const.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/WebAssembly/reference-types/issues/134#issuecomment-784879118, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO2CJMKJ6ZLB5V3762RMA5TTASXMNANCNFSM4YBWKO2A.
https://github.com/WebAssembly/reference-types/blob/063d34eda68108fac28d783beaf501c23e9e38d0/test/core/data.wast#L480
according to the Specification, it doesn't look like an invalid one.
may be it is