Skip to content

Commit 32603fd

Browse files
authored
unix: work around arm-linux-gnueabihf-gcc bug (#4537)
Both gcc 11 and 12 emit wrong code for a function call pointer in one very specific context. Fixes: #4532
1 parent 1c778bd commit 32603fd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/unix/fs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ static ssize_t uv__preadv_or_pwritev(int fd,
482482
atomic_store_explicit(cache, (uintptr_t) p, memory_order_relaxed);
483483
}
484484

485-
f = p;
485+
/* Use memcpy instead of `f = p` to work around a compiler bug,
486+
* see https://github.com/libuv/libuv/issues/4532
487+
*/
488+
memcpy(&f, &p, sizeof(p));
486489
return f(fd, bufs, nbufs, off);
487490
}
488491

0 commit comments

Comments
 (0)