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 c/112442] Segfault from casting a ptr when using -O2
Date: Thu, 09 Nov 2023 16:18:16 +0000 [thread overview]
Message-ID: <bug-112442-4-o9QsIpL6nW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112442-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112442
--- Comment #10 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Adam Andersson from comment #9)
> I was sure I had tried -fno-strict-aliasing without any difference, but I
> guessed I messed up somehow. Sorry about that.
>
> Still, is it not strange that -Wall doesn't generate a warning about this
> then?
-Wall only enables -Wstrict-aliasing=3 which may have false negatives.
-Wstrict-aliasing=1 or -Wstrict-aliasing=2 warns about this, but generally they
can produce many false positives (as they are documented).
Generally it's impossible to make a reliable way to detect aliasing violation
at compile time. For runtime checking LLVM folks were developing a Type
Sanitizer
(https://llvm.org/devmtg/2017-10/slides/Finkel-The%20Type%20Sanitizer.pdf) but
the development seems stalled now.
Thus we document "try -fno-strict-aliasing" in the "new bug" page as a "not so
bad" way to rule out aliasing issues (it's only "not so bad", not "very good"
because it may still hide real bugs).
prev parent reply other threads:[~2023-11-09 16:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 13:12 [Bug c/112442] New: " adam.andersson at elisapolystar dot com
2023-11-08 14:16 ` [Bug c/112442] " adam.andersson at elisapolystar dot com
2023-11-08 14:24 ` redi at gcc dot gnu.org
2023-11-08 14:33 ` pinskia at gcc dot gnu.org
2023-11-08 14:42 ` adam.andersson at elisapolystar dot com
2023-11-08 14:54 ` schwab@linux-m68k.org
2023-11-08 15:32 ` xry111 at gcc dot gnu.org
2023-11-08 15:35 ` xry111 at gcc dot gnu.org
2023-11-08 16:15 ` redi at gcc dot gnu.org
2023-11-08 17:43 ` adam.andersson at elisapolystar dot com
2023-11-09 16:18 ` 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-112442-4-o9QsIpL6nW@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).