Skip to content

Commit

Permalink
net: workaround a -prod -cc gcc bug (#20872)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbkpbot committed Feb 19, 2024
1 parent fffb82d commit 50e271a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vlib/net/tcp.c.v
Expand Up @@ -484,6 +484,9 @@ struct TcpSocket {
Socket
}

// This is a workaround for issue https://github.com/vlang/v/issues/20858
// `noline` ensure that in `-prod` mode(CFLAG = `-O3 -flto`), gcc does not generate wrong instruction sequence
@[noinline]
fn new_tcp_socket(family AddrFamily) !TcpSocket {
handle := $if is_coroutine ? {
socket_error(C.photon_socket(family, SocketType.tcp, 0))!
Expand Down

0 comments on commit 50e271a

Please sign in to comment.