diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2024-10-07 08:47:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 08:47:16 +0200 |
commit | 0be52c825176152ebe60ccd9f099b7722322c700 (patch) | |
tree | b59308c8d20726d094be54068e7f6059dbae4abb /src/unix | |
parent | 1cbffcbd5d097c31cdfa715f2a78fde93651d80c (diff) | |
download | libuv-0be52c825176152ebe60ccd9f099b7722322c700.tar.gz libuv-0be52c825176152ebe60ccd9f099b7722322c700.zip |
unix: workaround gcc bug on armv7 (#4564)
Disable optimization on `uv__preadv_or_pwritev`.
Fixes: https://github.com/libuv/libuv/issues/4532
Fixes: https://github.com/libuv/libuv/issues/4550
Diffstat (limited to 'src/unix')
-rw-r--r-- | src/unix/fs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/unix/fs.c b/src/unix/fs.c index d555491a..263d4bbc 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -461,7 +461,12 @@ static ssize_t uv__pwritev_emul(int fd, /* The function pointer cache is an uintptr_t because _Atomic void* * doesn't work on macos/ios/etc... + * Disable optimization on armv7 to work around the bug described in + * https://github.com/libuv/libuv/issues/4532 */ +#if defined(__arm__) && (__ARM_ARCH == 7) +__attribute__((optimize("O0"))) +#endif static ssize_t uv__preadv_or_pwritev(int fd, const struct iovec* bufs, size_t nbufs, @@ -482,10 +487,7 @@ static ssize_t uv__preadv_or_pwritev(int fd, atomic_store_explicit(cache, (uintptr_t) p, memory_order_relaxed); } - /* Use memcpy instead of `f = p` to work around a compiler bug, - * see https://github.com/libuv/libuv/issues/4532 - */ - memcpy(&f, &p, sizeof(p)); + f = p; return f(fd, bufs, nbufs, off); } |