public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "141242068 at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/114597] [GCC-14] Miscompilation of pointer assignment with inline assembly
Date: Fri, 05 Apr 2024 04:10:21 +0000	[thread overview]
Message-ID: <bug-114597-4-fe3fq4g7fk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114597-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from wierton <141242068 at smail dot nju.edu.cn> ---
Thanks a lot, I have checked it out.

I'm still somewhat confused. Does the difference in compilation stem from GCC
interpreting "=m" and "=r" differently, leading it to assume that once "n.p" is
declared as an output operand without matched input declaration (eg. "=m"
expects "m", "=r" expects "r"), its value is expected to change?

```
asm("":"=m"(n.p):"r"(n.p)); // n.p is expected to change
asm("":"=r"(n.p):"r"(n.p)); // n.p can retain its value
asm("":"=m"(n.p):"m"(n.p)); // n.p can retain its value
```

Thanks in advance for any further explanation you can provide.

  parent reply	other threads:[~2024-04-05  4:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  3:42 [Bug c/114597] New: " 141242068 at smail dot nju.edu.cn
2024-04-05  3:52 ` [Bug c/114597] " pinskia at gcc dot gnu.org
2024-04-05  3:54 ` pinskia at gcc dot gnu.org
2024-04-05  4:10 ` 141242068 at smail dot nju.edu.cn [this message]
2024-04-05  6:03 ` xry111 at gcc dot gnu.org
2024-04-05  7:57 ` 141242068 at smail dot nju.edu.cn

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-114597-4-fe3fq4g7fk@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).