public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
Date: Fri, 27 May 2022 08:09:05 +0000	[thread overview]
Message-ID: <bug-105744-4-Ehf1jF1kMg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105744-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to Kewen Lin from comment #3)
> Hi Zdenek,
> 
> Could you please double check the strncpy implementation on your side? and
> help to file one glibc issue if so.
> 
> One further reduced test case:
> 
> #define N 3
> char a[N];
> char c[N];
> 
> int
> main (void)
> {
>   asm volatile("xxspltib 18, 0xf" : : :"vs18");
>   __builtin_strncpy (c, a, N);
>   if (c[0] || c[1])
>     __builtin_abort ();
>   return 0;
> }

Hello Kewen,

thank you for the simple testcase. I can confirm it fails for me, and I am
using the problematic strncpy implementation:

...
   0x0000000010022f10 <+16>:      lbz     r0,0(r4)
   0x0000000010022f14 <+20>:      stb     r0,0(r3)
   0x0000000010022f18 <+24>:      addi    r11,r3,1
   0x0000000010022f1c <+28>:      addi    r5,r5,-1
   0x0000000010022f20 <+32>:      vspltisb v18,0
...
   0x000000001002319c <+668>:     rldicr  r10,r5,56,7
   0x00000000100231a0 <+672>:     stxvl   vs18,r11,r10
   0x00000000100231a4 <+676>:     blr

The code was added to the glibc tree only 18 months ago, so it might explain
why this wasn't triggered before.

I will open a glibc PR for this.

Many thanks,
Zdenek

  parent reply	other threads:[~2022-05-27  8:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26 18:08 [Bug rtl-optimization/105744] New: " zsojka at seznam dot cz
2022-05-27  6:31 ` [Bug rtl-optimization/105744] " rguenth at gcc dot gnu.org
2022-05-27  7:12 ` linkw at gcc dot gnu.org
2022-05-27  7:47 ` linkw at gcc dot gnu.org
2022-05-27  7:55 ` linkw at gcc dot gnu.org
2022-05-27  8:09 ` zsojka at seznam dot cz [this message]
2022-05-27  8:23 ` linkw 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-105744-4-Ehf1jF1kMg@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).