public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] linux: Fix i686 with gcc6
Date: Wed, 26 Jul 2023 14:22:20 +0000 (GMT)	[thread overview]
Message-ID: <20230726142220.F3E2E385AF9E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dbc4b032dc5c4ef0c46e9de23c46b1698bad4412

commit dbc4b032dc5c4ef0c46e9de23c46b1698bad4412
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date:   Tue Jul 25 12:16:40 2023 -0300

    linux: Fix i686 with gcc6
    
    On __convert_scm_timestamps GCC 6 issues an warning that tvts[0]/tvts[1]
    maybe be used uninitialized, however it would be used if type is set to a
    value different than 0 (done by either COMPAT_SO_TIMESTAMP_OLD or
    COMPAT_SO_TIMESTAMPNS_OLD) which will fallthrough to 'common' label.
    
    It does not show with gcc 7 or more recent versions.
    
    Checked on i686-linux-gnu.
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 sysdeps/unix/sysv/linux/convert_scm_timestamps.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
index 42f9613416..06c8adeee1 100644
--- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
+++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
@@ -23,6 +23,7 @@
 # include <string.h>
 # include <sys/socket.h>
 # include <socket-constants-time64.h>
+# include <libc-diag.h>
 
 /* It converts the first SO_TIMESTAMP or SO_TIMESTAMPNS with 32-bit time and
    appends it to the control buffer.  The 32-bit time field is kept as-is.
@@ -44,7 +45,15 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
      'struct __kernel_sock_timeval' while for SO_TIMESTAMPNS_NEW is a
      'struct __kernel_timespec'.  In either case it is two uint64_t
      members.  */
+
+  /* GCC 6 issues an warning that tvts[0]/tvts[1] maybe be used uninitialized,
+     however it would be used if type is set to a value different than 0
+     (done by either COMPAT_SO_TIMESTAMP_OLD or COMPAT_SO_TIMESTAMPNS_OLD)
+     which will fallthrough to 'common' label.  */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
   int64_t tvts[2];
+  DIAG_POP_NEEDS_COMMENT;
   int32_t tmp[2];
 
   struct cmsghdr *cmsg, *last = NULL;

                 reply	other threads:[~2023-07-26 14:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230726142220.F3E2E385AF9E@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).