rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.04k stars 12.79k forks source link

pthread_attr_union uses wrong types on wasi preview1 with threads #114608

Closed programmerjake closed 1 year ago

programmerjake commented 1 year ago

https://github.com/rust-lang/rust/blob/5697f1620de6bede6f575b51b01509d8c07830cf/library/std/src/sys/wasi/thread.rs#L19-L26

the type which should have its size compared is c_long, not c_int:

wasi-libc's code linked in comment above:

TYPEDEF struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;

since you made the commit, cc @g0djan

g0djan commented 1 year ago

Hey you're right, I opened a PR with a fix