unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Disable -Wmaybe-uninitialized for total_deadline in sunrpc/clnt_udp.c [committed]
@ 2019-10-02 21:12 Joseph Myers
  2019-10-02 21:15 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2019-10-02 21:12 UTC (permalink / raw
  To: libc-alpha

To work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691>
for RV32, we recently disabled -Wmaybe-uninitialized for some inline
functions in inet/net-internal.h, as included by sunrpc/clnt_udp.c.

The same error has now appeared with current GCC trunk for MIPS, in a
form that is located at the definition of the variable in question and
so unaffected by the disabling in inet/net-internal.h.  Thus, this
patch adds the same disabling around the definition of that variable,
to cover the MIPS case.

Tested with build-many-glibcs.py (compilers and glibcs stages) for
mips64-linux-gnu with GCC mainline.

2019-10-02  Joseph Myers  <joseph@codesourcery.com>

	* sunrpc/clnt_udp.c: Include <libc-diag.h>.
	(clntudp_call): Disable -Wmaybe-uninitialized around declaration
	of total_deadline.

diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index c2436e3ebc..ee79b09b40 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -57,6 +57,7 @@
 #include <kernel-features.h>
 #include <inet/net-internal.h>
 #include <shlib-compat.h>
+#include <libc-diag.h>
 
 extern u_long _create_xid (void);
 
@@ -290,7 +291,17 @@ clntudp_call (/* client handle */
   int anyup;			/* any network interface up */
 
   struct deadline_current_time current_time = __deadline_current_time ();
+  /* GCC 10 for MIPS reports total_deadline as possibly used
+     uninitialized; see
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691>.  In fact it
+     is initialized conditionally and only ever used under the same
+     condition.  The same warning is also disabled in
+     inet/net-internal.h because in some other configurations GCC
+     gives the warning in an inline function.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
+  DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
 
   /* Choose the timeout value.  For non-sending usage (xargs == NULL),

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Disable -Wmaybe-uninitialized for total_deadline in sunrpc/clnt_udp.c [committed]
  2019-10-02 21:12 Disable -Wmaybe-uninitialized for total_deadline in sunrpc/clnt_udp.c [committed] Joseph Myers
@ 2019-10-02 21:15 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-10-02 21:15 UTC (permalink / raw
  To: Joseph Myers, libc-alpha

On 10/2/19 3:12 PM, Joseph Myers wrote:
> To work around <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691>
> for RV32, we recently disabled -Wmaybe-uninitialized for some inline
> functions in inet/net-internal.h, as included by sunrpc/clnt_udp.c.
> 
> The same error has now appeared with current GCC trunk for MIPS, in a
> form that is located at the definition of the variable in question and
> so unaffected by the disabling in inet/net-internal.h.  Thus, this
> patch adds the same disabling around the definition of that variable,
> to cover the MIPS case.
> 
> Tested with build-many-glibcs.py (compilers and glibcs stages) for
> mips64-linux-gnu with GCC mainline.
> 
> 2019-10-02  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sunrpc/clnt_udp.c: Include <libc-diag.h>.
> 	(clntudp_call): Disable -Wmaybe-uninitialized around declaration
> 	of total_deadline.
THanks.  My tester started complaining about this too.  Not sure what
changed on the GCC side.  Thanks for GCC bug report.  I expect to look
at all the Wuninitialized bugs during stage3 (I do that every year ;-)

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-02 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-02 21:12 Disable -Wmaybe-uninitialized for total_deadline in sunrpc/clnt_udp.c [committed] Joseph Myers
2019-10-02 21:15 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).