public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "luto at mit dot edu" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/16197] CMSG_DATA results in (possibly correct) string aliasing warnings on gcc
Date: Thu, 21 Nov 2013 05:32:00 -0000	[thread overview]
Message-ID: <bug-16197-131-oVCJOrZa4F@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16197-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16197

--- Comment #2 from Andy Lutomirski <luto at mit dot edu> ---
I suspect that glibc's code is fine, insofar programs using it aren't invoking
undefined behavior.  That being said, I'm not sure I can blame gcc for warning.
 glibc is doing something roughly equivalent to:

struct foo { unsigned char array[10]; };

void func(struct foo *foo)
{
   int x = *(int*)foo->array;
}

There's no actual aliasing violation there (the object is of type int, not
char), but the code sure *looks* like an aliasing violation.

Given that the other variant is already there in bits/socket.h, it seems to me
that glibc should just switch to using it and eliminate the warning.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2013-11-21  5:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 21:31 [Bug libc/16197] New: " luto at mit dot edu
2013-11-21  0:26 ` [Bug libc/16197] " bugdal at aerifal dot cx
2013-11-21  5:32 ` luto at mit dot edu [this message]
2013-12-02  6:45 ` crrodriguez at opensuse dot org
2014-06-13 11:59 ` fweimer at redhat dot com
2015-08-27 22:18 ` [Bug network/16197] " jsm28 at gcc dot gnu.org

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=bug-16197-131-oVCJOrZa4F@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).