public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "krystalgamer at protonmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/103882] Register corruption in ASM only functions when optization is -O2/-Os/-O3
Date: Sat, 01 Jan 2022 15:06:43 +0000	[thread overview]
Message-ID: <bug-103882-4-XFO5GCgfoj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103882-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Jose Silva <krystalgamer at protonmail dot com> ---
(In reply to Jakub Jelinek from comment #7)
> The compiler has no idea either (it has intentionally no idea what the
> inline asm does, it is a black box to the compiler), so that is why you need
> to specify it.  Look at C library sources, or kernel and find out what is
> and what isn't clobbered and add the clobbers.

It seems weird that GCC puts the sole responsibility on the programmer when
dealing with ASM. In my honest opinion, the compiler should be cautious when
interacting with hand-written ASM, the same way when interacting with function
pointers. 

It does allow for more optimization opportunities but it implies the programmer
knows a lot about the underlying architecture and system.



I'd like to implement a feature that automatically sets a function as noipa
when containing ASM statements, could you please point me in the codebase where
I could start?

  parent reply	other threads:[~2022-01-01 15:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 17:11 [Bug target/103882] New: " krystalgamer at protonmail dot com
2021-12-31 18:53 ` [Bug target/103882] " pinskia at gcc dot gnu.org
2021-12-31 20:48 ` krystalgamer at protonmail dot com
2021-12-31 20:51 ` pinskia at gcc dot gnu.org
2021-12-31 20:51 ` pinskia at gcc dot gnu.org
2021-12-31 22:36 ` jakub at gcc dot gnu.org
2022-01-01 12:45 ` krystalgamer at protonmail dot com
2022-01-01 14:05 ` jakub at gcc dot gnu.org
2022-01-01 14:11 ` jakub at gcc dot gnu.org
2022-01-01 15:06 ` krystalgamer at protonmail dot com [this message]
2022-01-01 16:37 ` jakub at gcc dot gnu.org
2022-01-01 19:19 ` krystalgamer at protonmail dot com
2022-01-01 19:47 ` schwab@linux-m68k.org
2022-01-01 20:34 ` jakub at gcc dot gnu.org
2022-01-01 23:15 ` krystalgamer at protonmail dot com
2022-01-02 13:27 ` jakub at gcc dot gnu.org
2022-01-02 14:40 ` krystalgamer at protonmail dot com
2022-01-02 15:00 ` schwab@linux-m68k.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-103882-4-XFO5GCgfoj@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).