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

cmd/asm: integer comparison is always false #11278

Closed
tzneal opened this issue Jun 19, 2015 · 4 comments
Closed

cmd/asm: integer comparison is always false #11278

tzneal opened this issue Jun 19, 2015 · 4 comments
Milestone

Comments

@tzneal
Copy link
Member

tzneal commented Jun 19, 2015

cmd/asm/internal/asm/parse.go:817: comparison of identifier shift < 0 is always false

shift is a uint64, and can never be negative. The check and error is unreachable code.

func (p *Parser) term() uint64 {
        value := p.factor()
        for {

...
                case lex.RSH:
                        p.next()
                        shift := p.term()
                        if shift < 0 {
                                p.errorf("negative right shift %d", shift)
                        }

@tzneal tzneal changed the title cmd/asm: integer comparison is always true cmd/asm: integer comparison is always false Jun 19, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 19, 2015
@mikioh mikioh modified the milestones: Go1.5, Go1.6 Jun 21, 2015
@rsc
Copy link
Contributor

rsc commented Jun 22, 2015

The fix should have been to change shift < 0 to int64(shift) < 0.

@rsc rsc reopened this Jun 22, 2015
@rsc
Copy link
Contributor

rsc commented Jun 22, 2015

Replied to CL.

@rsc rsc reopened this Jun 22, 2015
@rsc
Copy link
Contributor

rsc commented Jun 29, 2015

I believe this is finally fixed. If not, please don't make any more changes before Go 1.5 is released.

@rsc rsc closed this as completed Jun 29, 2015
@robpike
Copy link
Contributor

robpike commented Jun 29, 2015

It is fixed.

@golang golang locked and limited conversation to collaborators Jun 28, 2016
@rsc rsc unassigned robpike Jun 23, 2022
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

6 participants