public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/103830] [12 Regression] null pointer access optimized away by removing function call at -Og
Date: Fri, 28 Jan 2022 12:08:26 +0000 [thread overview]
Message-ID: <bug-103830-4-mHpUmBTK6T@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103830-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103830
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Richard Biener from comment #7)
> A fix in the source would be:
>
> void MyClass::call() {
> volatile char * volatile null = nullptr;
> *null = 1; /* line 26 */
> }
>
> which then compiles to
>
> movq $0, -8(%rsp)
> movq -8(%rsp), %rax
> movb $1, (%rax)
> ret
>
> (some "advanced" means using some asm() to hide the constant from the
> compiler might also work)
Yes, that works, but I would prefer:
*(volatile char*)1 = 2;
prev parent reply other threads:[~2022-01-28 12:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-26 10:00 [Bug rtl-optimization/103830] New: volatile optimized away bernd.edlinger at hotmail dot de
2021-12-26 10:10 ` [Bug rtl-optimization/103830] " pinskia at gcc dot gnu.org
2021-12-26 10:19 ` [Bug ipa/103830] [12 Regression] null pointer access optimized away by removing function call at -Og pinskia at gcc dot gnu.org
2021-12-27 16:20 ` jakub at gcc dot gnu.org
2022-01-04 13:35 ` rguenth at gcc dot gnu.org
2022-01-04 14:52 ` hubicka at kam dot mff.cuni.cz
2022-01-28 12:02 ` rguenth at gcc dot gnu.org
2022-01-28 12:04 ` rguenth at gcc dot gnu.org
2022-01-28 12:06 ` rguenth at gcc dot gnu.org
2022-01-28 12:08 ` bernd.edlinger at hotmail dot de [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-103830-4-mHpUmBTK6T@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).