public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chenglulu at loongson dot cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/109035] meaningless memory store on RISC-V and LoongArch
Date: Wed, 08 Mar 2023 03:16:53 +0000	[thread overview]
Message-ID: <bug-109035-4-DARF5c7TRB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109035-4@http.gcc.gnu.org/bugzilla/>

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

chenglulu <chenglulu at loongson dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chenglulu at loongson dot cn

--- Comment #2 from chenglulu <chenglulu at loongson dot cn> ---
I think this is most likely caused by the implementation of the public code. If
the immediate value is set to be large enough, such as 0xfffffff, aarch64 also
has the same problem.

$ cat t.c
int test(int x)
{
        char buf[0xfffffff];
        return buf[x];
}

$ ./cc1 t.c -o - -O2  2>/dev/null | grep test -A20
test:
.LFB0:
        .cfi_startproc
        mov     x12, 16
        mov     x2, 16
        movk    x12, 0x1000, lsl 16
        sub     sp, sp, x12
        .cfi_def_cfa_offset 268435472
        movk    x2, 0x1000, lsl 16
        mov     x1, -268435456
        add     x1, x2, x1
        add     x1, sp, x1
        str     x1, [sp, 8]
        ldrb    w0, [x1, w0, sxtw]
        add     sp, sp, x12
        .cfi_def_cfa_offset 0
        ret

The "str x1, [sp, 8]" instruction also has the same problem.

  parent reply	other threads:[~2023-03-08  3:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  7:51 [Bug rtl-optimization/109035] New: " xry111 at gcc dot gnu.org
2023-03-06  7:52 ` [Bug rtl-optimization/109035] " xry111 at gcc dot gnu.org
2023-03-06  8:02 ` xry111 at gcc dot gnu.org
2023-03-08  3:16 ` chenglulu at loongson dot cn [this message]
2023-03-08  3:37 ` xry111 at gcc dot gnu.org
2023-03-08  3:55 ` chenglulu at loongson dot cn
2023-03-11  6:44 ` chenglulu at loongson dot cn
2023-03-11  7:00 ` chenglulu at loongson dot cn
2023-11-02 19:25 ` vmakarov at gcc dot gnu.org
2023-11-02 19:47 ` law at gcc dot gnu.org
2023-11-03  6:52 ` xry111 at gcc dot gnu.org
2023-11-03  7:46 ` xry111 at gcc dot gnu.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-109035-4-DARF5c7TRB@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).