public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xry111 at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/115582] [15 regression] wrong code when accessing members of incompatible type structure
Date: Thu, 27 Jun 2024 01:37:34 +0000	[thread overview]
Message-ID: <bug-115582-4-IFHxJKLLqf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115582-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115582

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xry111 at gcc dot gnu.org

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
FWIW there are too many online articles discussing aliasing rule but failing to
get the concept correct.  As Andrew has explained the aliasing rule is all
about the type used for accessing a lvalue, it's not related to pointer
casting, at all.

Checking against pointer casting is just a heruistic way for finding aliasing
bugs and it may have false positives or false negatives.  This renders
-Wstrict-aliasing almost useless.

If a pointer cast to (T *) made the type alias with T, the aliasing rule would
be meaningless because in a different TU (that the compiler cannot see) any
pointer can be casted to anything.  For example, *everything* is casted to
(char *) in Glibc memcpy() thus *everything* would be aliasing.  This would be
obviously irrational.

      parent reply	other threads:[~2024-06-27  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 13:48 [Bug tree-optimization/115582] New: [regression 15] " tangyixuan at mail dot dlut.edu.cn
2024-06-21 14:05 ` [Bug tree-optimization/115582] [15 regression] " sjames at gcc dot gnu.org
2024-06-21 14:11 ` pinskia at gcc dot gnu.org
2024-06-21 14:13 ` sjames at gcc dot gnu.org
2024-06-21 15:39 ` tangyixuan at mail dot dlut.edu.cn
2024-06-21 15:56 ` pinskia at gcc dot gnu.org
2024-06-27  1:37 ` xry111 at gcc dot gnu.org [this message]

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-115582-4-IFHxJKLLqf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).