public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
@ 2022-05-26 18:08 zsojka at seznam dot cz
2022-05-27 6:31 ` [Bug rtl-optimization/105744] " rguenth at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2022-05-26 18:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
Bug ID: 105744
Summary: [11/12/13 Regression] wrong code with
-fexpensive-optimizations -flive-range-shrinkage on
powerpc64le-unknown-linux-gnu
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: powerpc64le-unknown-linux-gnu
Created attachment 53040
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53040&action=edit
reduced testcase
Output:
$ powerpc64le-unknown-linux-gnu-gcc -fexpensive-optimizations
-flive-range-shrinkage testcase.c -static
$ qemu-ppc64le -- ./a.out
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
(gdb) p/x a
$5 = {0x0, 0x0, 0x0, 0x0}
(gdb) p/x b
$6 = {0x0, 0x0, 0x0, 0x0}
(gdb) p/x c
$7 = {0xffff00, 0x0, 0x0, 0x0}
(gdb) p/x d
$8 = {0x0, 0x0, 0x0, 0x0}
(gdb) p/x e
$9 = {0x0, 0x0, 0x0, 0x0}
(gdb) p/x u
$10 = {0x1 <repeats 32 times>}
$ powerpc64le-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-powerpc64le/bin/powerpc64le-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-771-20220526001630-g3dff965cae6-checking-yes-rtl-df-extra-powerpc64le/bin/../libexec/gcc/powerpc64le-unknown-linux-gnu/13.0.0/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/powerpc64le-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=powerpc64le-unknown-linux-gnu
--with-ld=/usr/bin/powerpc64le-unknown-linux-gnu-ld
--with-as=/usr/bin/powerpc64le-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-771-20220526001630-g3dff965cae6-checking-yes-rtl-df-extra-powerpc64le
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220526 (experimental) (GCC)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
@ 2022-05-27 6:31 ` rguenth at gcc dot gnu.org
2022-05-27 7:12 ` linkw at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 6:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu 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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-27 7:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |linkw at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2022-05-27
--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
Can be reproduced without cross build compiler.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu 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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-27 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
This exposes one bug in glibc strncpy power9 implementation
In
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=sysdeps/powerpc/powerpc64/le/power9/strncpy.S
lbz r0,0(r4)
stb r0,0(r3)
addi r11,r3,1
addi r5,r5,-1
vspltisb v18,0 /* Zeroes in v18 */
...
L(zero_padding_end):
sldi r10,r5,56 /* stxvl wants size in top 8 bits */
stxvl v18,r11,r10 /* Partial store */
blr
The code at label "zero_padding_end" is supposed to use v18, but the stxvl will
take the 18 as vsx No. instead of vr No, so it ends up to use the wrong
register vs18 instead of v18 for the store.
The reason why the optimization option matters is that some optimization happen
to generate some sequence to modify the value of vs18 then it's not expected to
be zero any more.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
` (2 preceding siblings ...)
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
2022-05-27 8:23 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-27 7:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tuliom at ascii dot art.br
--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
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;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
` (3 preceding siblings ...)
2022-05-27 7:55 ` linkw at gcc dot gnu.org
@ 2022-05-27 8:09 ` zsojka at seznam dot cz
2022-05-27 8:23 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2022-05-27 8:09 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/105744] [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu zsojka at seznam dot cz
` (4 preceding siblings ...)
2022-05-27 8:09 ` zsojka at seznam dot cz
@ 2022-05-27 8:23 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-05-27 8:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105744
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---
>
> I will open a glibc PR for this.
>
Nice, thanks Zdenek! Changing the status ...
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-05-27 8:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 18:08 [Bug rtl-optimization/105744] New: [11/12/13 Regression] wrong code with -fexpensive-optimizations -flive-range-shrinkage on powerpc64le-unknown-linux-gnu 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
2022-05-27 8:23 ` linkw at gcc dot gnu.org
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).