[PATCH v1] Silence warning with gcc 15 and O0/01
Gert Doering <[email protected]> Thu, 23 Jul 2026 20:04:38 +0200
| Newsgroups | gmane.network.openvpn.devel |
|---|---|
| Message-ID | <[email protected]> |
From: Arne Schwabe <[email protected]> When compiling with low optimisation level gcc complains route.c:1783:44: error: conversion from ‘int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Werror=conversion] 1783 | r6->network.s6_addr[byte--] &= (0xff << bits_to_clear); With higher it apparently detects that this is cannot be and does not trigger the warning. Explicitly cast to uint8_t to silence this warning Change-Id: I96d3698601bb5aac3a0d7ac6ac5b5dd23c975517 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1731 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1731 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 81ce867..8ea745d 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1780,7 +1780,7 @@ } else { - r6->network.s6_addr[byte--] &= (0xff << bits_to_clear); + r6->network.s6_addr[byte--] &= (uint8_t)(0xff << bits_to_clear); bits_to_clear = 0; } } _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel