Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: can do bitwise or on fp constants #11566

Closed
dvyukov opened this issue Jul 3, 2015 · 2 comments
Closed

gccgo: can do bitwise or on fp constants #11566

dvyukov opened this issue Jul 3, 2015 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 3, 2015

gccgo successfully compiles the following program:

package a
const d rune = 1e2|2

gc and go/types reject this program saying:

illegal constant expression: untyped number | untyped number
invalid operation: operator | not defined for 1e2 (untyped float constant 100)

gcc version 6.0.0 2015070 (experimental) (GCC)

@dvyukov
Copy link
Member Author

dvyukov commented Jul 3, 2015

@paranoiacblack

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12716 mentions this issue.

mydongistiny pushed a commit to mydongistiny/GCC_SaberMod that referenced this issue Sep 14, 2015
    
    When evaluating a constant expression, the gofrontend would incorrectly
    force each operand to be represented as the resulting type before
    checking if the operation was valid with the untyped constants.
    According to the language specification on constant
    expressions(http://golang.org/ref/spec#Constant_expressions): "Untyped
    boolean, numeric, and string constants may be used as operands wherever
    it is legal to use an operand of boolean, numeric, or string type,
    respectively."
    
    Fixes golang/go#11566.
    
    Reviewed-on: https://go-review.googlesource.com/12716


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227758 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants