public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "acoplan at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/114284] New: [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice)
Date: Fri, 08 Mar 2024 13:12:04 +0000	[thread overview]
Message-ID: <bug-114284-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114284
           Summary: [14 Regression] arm: Load of volatile short gets
                    miscompiled (loaded twice)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following is a wrong code regression in GCC 14:

volatile short x;
short foo() {
  return x;
}

with -march=armv8-m.base -O2 on the trunk we get:

foo:
        movw    r3, #:lower16:.LANCHOR0
        movt    r3, #:upper16:.LANCHOR0
        ldrh    r2, [r3]
        movs    r0, #0
        ldrsh   r0, [r3, r0]
        bx      lr

i.e. x is loaded twice, but with GCC 13 we get:

foo:
        movw    r3, #:lower16:.LANCHOR0
        movt    r3, #:upper16:.LANCHOR0
        ldrh    r0, [r3]
        sxth    r0, r0
        bx      lr

I suppose ideally we would have just one ldrsh, but the GCC 13 code is OK.

             reply	other threads:[~2024-03-08 13:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 13:12 acoplan at gcc dot gnu.org [this message]
2024-03-08 13:25 ` [Bug target/114284] " rguenth at gcc dot gnu.org
2024-03-08 14:31 ` [Bug target/114284] [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) since r14-8319 jakub at gcc dot gnu.org
2024-03-08 15:02 ` acoplan at gcc dot gnu.org
2024-03-08 15:03 ` jakub at gcc dot gnu.org
2024-03-08 15:05 ` jakub at gcc dot gnu.org
2024-03-08 15:30 ` jakub at gcc dot gnu.org
2024-03-09 12:05 ` cvs-commit at gcc dot gnu.org
2024-03-09 15:03 ` law at gcc dot gnu.org
2024-03-09 15:03 ` law at gcc dot gnu.org
2024-03-10  1:12 ` roger at nextmovesoftware dot com

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