Bug 92861 - Passes relative time to sem_timedwait on GNU/Hurd
Summary: Passes relative time to sem_timedwait on GNU/Hurd
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
Depends on:
Reported: 2019-12-09 01:11 UTC by Samuel Thibault
Modified: 2019-12-09 18:11 UTC (History)
0 users

See Also:
Host: i686-gnu
Target: i686-gnu
Build: i686-gnu
Known to work:
Known to fail:
Last reconfirmed:

proposed fix (722 bytes, patch)
2019-12-09 01:11 UTC, Samuel Thibault
Details | Diff
fix duplicate definition (184 bytes, patch)
2019-12-09 13:13 UTC, Samuel Thibault
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Thibault 2019-12-09 01:11:07 UTC
Created attachment 47442 [details]
proposed fix

In src/libgo/go/runtime/os_hurd.go, a relative time is set in var ts, and &ts is passed to sem_timedwait. But sem_timedwait expects an absolute time, not a relative time. The attached patch fixes this by using the time from clock_gettime(CLOCK_REALTIME), like is done in os_aix.go.
Comment 1 ian@gcc.gnu.org 2019-12-09 03:44:05 UTC
Author: ian
Date: Mon Dec  9 03:43:33 2019
New Revision: 279106

URL: https://gcc.gnu.org/viewcvs?rev=279106&root=gcc&view=rev
	PR go/92861
    runtime: use absolute time for sem_timedwait
    Patch by Samuel Thibault.
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210457

Comment 2 Ian Lance Taylor 2019-12-09 03:53:01 UTC
Thanks, committed.
Comment 3 Samuel Thibault 2019-12-09 13:13:34 UTC
Created attachment 47446 [details]
fix duplicate definition

Ah, sorry, _CLOCK_REALTIME is actually already getting defined in the generated libgo/runtime_sysinfo.go file, the attached patch is needed on top of what was already committed.
Comment 4 Samuel Thibault 2019-12-09 13:13:57 UTC
Reopening the bug for the fix to be commited
Comment 5 Ian Lance Taylor 2019-12-09 18:01:04 UTC
You can also just send patches to gcc-patches@gcc.gnu.org and/or gofrontend-dev@googlegroups.com.
Comment 6 ian@gcc.gnu.org 2019-12-09 18:04:33 UTC
Author: ian
Date: Mon Dec  9 18:03:53 2019
New Revision: 279136

URL: https://gcc.gnu.org/viewcvs?rev=279136&root=gcc&view=rev
	PR go/92861
    runtime: don't define CLOCK_REALTIME in os_hurd.go
    It's already defined in sysinfo.go.
    Patch by Samuel Thibault.
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/210538

Comment 7 Ian Lance Taylor 2019-12-09 18:11:35 UTC
Patch committed.