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

gollvm/gofrontend: Should EPOLLET be positive or negative? #52843

Closed
tsqua opened this issue May 11, 2022 · 2 comments
Closed

gollvm/gofrontend: Should EPOLLET be positive or negative? #52843

tsqua opened this issue May 11, 2022 · 2 comments
Assignees
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@tsqua
Copy link

tsqua commented May 11, 2022

What version of Go are you using (go version)?

$ go version

gollvm

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env


Debian
Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz (Cascade Lake)

What did you do?

error case:

package main

import (
    "fmt"
    "syscall"
)

func main() {
    b := foo2()
    fmt.Println(b)
}

//go:noinline
func foo2() uint32 {
    var evt uint32
    //evt = (-syscall.EPOLLET) | syscall.EPOLLOUT
    evt = (-syscall.EPOLLET)
    fmt.Println(evt)
    return evt
}

What did you expect to see?

2147483648
2147483648

What did you see instead?

error: integer constant overflow

Error description

Found in netpoll building, the user assume this value is negative and get its opposite value. But it's positive in gollvm.
In golang/go, EPOLLET is set to -0x80000000. Is it better to be consistent between the two compilers? Therefore, there is no programming gap when programmers use different compilers. (https://github.com/golang/go/blob/master/src/syscall/zerrors_linux_amd64.go)

@tsqua tsqua changed the title gollvm/gofrontend: gollvm/gofrontend: EPOLLET should be positive or negative? May 11, 2022
@tsqua tsqua changed the title gollvm/gofrontend: EPOLLET should be positive or negative? gollvm/gofrontend: Should EPOLLET be positive or negative? May 11, 2022
@heschi heschi added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 11, 2022
@heschi heschi added this to the Unreleased milestone May 11, 2022
@heschi
Copy link
Contributor

heschi commented May 11, 2022

cc @thanm

@thanm thanm self-assigned this May 12, 2022
@ianlancetaylor
Copy link
Contributor

The value varies with the gc syscall package also. Sometimes it is 0x80000000, sometimes it is -0x80000000, depending on the target. It does happen to be -0x80000000 on linux-amd64.

The code in question should be rewritten to use the golang.org/x/sys/unix package instead, where the value is consistently 0x80000000.

Closing because although the situation is unfortunate, I don't think there is anything to do here.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants