Skip to contentSkip to conversation

work around false positive warning with mingw 12

PATCH In review Heiko Hund 3 participants 3 messages Jul 6, 2023 – Jul 7, 2023

lore
Share & tools
lore

Heiko Hund

author
#0 lore raw

PATCH 1/1 work around false positive warning with mingw 12

When cross compiling for Windows with Ubuntu 23.04 mingw complains about

route.c:344:26: warning: ‘special.S_un.S_addr’ may be used uninitialized

which is wrong technically. However the workaround isn't really intrusive and while there are other warnings caused by libtool, the cmake mingw build completes with -Werror now.

Change-Id I8a0f59707570722eab41af2db76980ced04e6d54
---
 src/openvpn/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/route.c +1 -1
index 0d04a5a3..0b369da4 100644
@@ -319,7 +319,7 @@ init_route(struct route_ipv4 *r,
     const in_addr_t default_netmask = IPV4_NETMASK_HOST;
     bool status;
     int ret;
-    struct in_addr special;
+    struct in_addr special = {0};
 
     CLEAR(*r);
     r->option = ro;
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw

Am 06.07.23 um 19:19 schrieb Heiko Hund:

Quoted 19 lines

When cross compiling for Windows with Ubuntu 23.04 mingw complains about

route.c:344:26: warning: ‘special.S_un.S_addr’ may be used uninitialized

which is wrong technically. However the workaround isn't really intrusive and while there are other warnings caused by libtool, the cmake mingw build completes with -Werror now.

Change-Id I8a0f59707570722eab41af2db76980ced04e6d54
---
  src/openvpn/route.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/route.c +0 -0
index 0d04a5a3..0b369da4 100644

src/openvpn/route.c init_route(struct route_ipv4 *r, · line 325

Quoted 8 lines
src/openvpn/route.c +1 -1
@@ -319,7 +319,7 @@ init_route(struct route_ipv4 *r,
      const in_addr_t default_netmask = IPV4_NETMASK_HOST;
      bool status;
      int ret;
-    struct in_addr special;
+    struct in_addr special = {0};
 
      CLEAR(*r);
      r->option = ro;

Good enough.

#2 lore raw
In reply to Heiko Hund

Test compiled on Linux and FreeBSD, just to get two more compiler's opinions...

Your patch has been applied to the master and release/2.6 branch.

commit d559affd313a8f995db15908887fbc8f16a24659 (master) commit cbf295ab42affcbdc09261cf3a39eb1d3d9f9cb2 (release/2.6)

Author: Heiko Hund
Date:   Thu Jul 6 19:19:22 2023 +0200
     work around false positive warning with mingw 12

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26831.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering