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 19:19:15 +0000	[thread overview]
Message-ID: <bug-103882-4-Sq2dVftHQJ@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

Jose Silva <krystalgamer at protonmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |WONTFIX

--- Comment #11 from Jose Silva <krystalgamer at protonmail dot com> ---
> much more important is that it needs to know what the inline asm does for code generation within the function, it needs to know in which registers or memory it can spill values live across the inline asm etc.
> if you are unable or not willing to tell the compiler how it behaves

Read the title of issue. This problem only manifests with O2/Os/O3, O0 and O1
don't exhibit it because IPA RA doesn't kick in. So no, the compiler doesn't
need to be told how it behaves if it takes precautions. The only reason to tell
a compiler something is to further optimize something, in any other
circumstance it should treat the piece of code as a black-box as you said.

What we're arguing here is about sensible compiler defaults. By default a
compiler should be cautious about asm statements and protect the surrounding
code by respecting the ABI. The programmer should be able to override this
behavior, not the other way around like GCC does.

There is absolutely no need to tell the compiler something he could've easily
accounted for.

> Don't use inline asm 

Wish I didn't need to, but there's no way of doing syscalls without it.



On the other hand, since you avoided answering my question regarding modifying
GCC I suppose you're not familiar with the codebase. Please refrain from
polluting this discussion with unnecessary noise if you don't wish to help.

  parent reply	other threads:[~2022-01-01 19:19 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
2022-01-01 16:37 ` jakub at gcc dot gnu.org
2022-01-01 19:19 ` krystalgamer at protonmail dot com [this message]
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-Sq2dVftHQJ@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).