public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111428] New: RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90
@ 2023-09-15 20:26 patrick at rivosinc dot com
  2023-09-21  7:06 ` [Bug target/111428] " juzhe.zhong at rivai dot ai
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: patrick at rivosinc dot com @ 2023-09-15 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111428
           Summary: RISC-V vector: Flaky segfault in
                    {min|max}val_char_{1|2}.f90
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Created attachment 55906
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55906&action=edit
Excerpt from the debug log

Failures:
FAIL: gfortran.dg/minval_char_1.f90   -O3 -g  execution test
FAIL: gfortran.dg/minval_char_1.f90   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  execution test
FAIL: gfortran.dg/minval_char_2.f90   -O3 -g  execution test
FAIL: gfortran.dg/minval_char_2.f90   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  execution test

FAIL: gfortran.dg/maxval_char_1.f90   -O3 -g  execution test
FAIL: gfortran.dg/maxval_char_1.f90   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  execution test
FAIL: gfortran.dg/maxval_char_2.f90   -O3 -g  execution test
FAIL: gfortran.dg/maxval_char_2.f90   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  execution test

Observed on:
rv64gcv_zvbb_zvbc_zvkg_zvkn_zvknc_zvkned_zvkng_zvknha_zvknhb_zvks_zvksc_zvksed_zvksg_zvksh_zvkt-lp64d
rv64gcv-lp64d
rv64imafdcv_zicond_zawrs_zbc_zvkng_zvksg_zvbb_zvbc_zicsr_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt-lp64d

Seems to only occur on rv64 glibc targets with the v extension enabled.

Known to pass: r14-3834-gd05aac047e0
Known to fail: r14-3840-g88a0a883960

Replicated locally using
https://github.com/patrick-rivos/riscv-gnu-toolchain/tree/29d071a8eec4603ff5fe4fe21d7e4ffa24f705f0
git submodule update --init gcc
cd gcc && git checkout 316d57da5bb9205b946afc56d78582fee874e4b5
cd .. && mkdir build && cd build
../configure --prefix=$(pwd) --with-arch=rv64gcv --with-abi=lp64
make report-linux -j32

There was previously flaky behavior with these testcases, but it's been
resolved for other targets:
https://gcc.gnu.org/legacy-ml/gcc-patches/2017-12/msg00807.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83379

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/111428] RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90
  2023-09-15 20:26 [Bug target/111428] New: RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90 patrick at rivosinc dot com
@ 2023-09-21  7:06 ` juzhe.zhong at rivai dot ai
  2023-09-21 10:16 ` rdapp at gcc dot gnu.org
  2023-10-10 19:08 ` rdapp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-09-21  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
Hi, Robin.
Could you take a look at it?
I doubt it is also the GIMPLE FOLD issue.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/111428] RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90
  2023-09-15 20:26 [Bug target/111428] New: RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90 patrick at rivosinc dot com
  2023-09-21  7:06 ` [Bug target/111428] " juzhe.zhong at rivai dot ai
@ 2023-09-21 10:16 ` rdapp at gcc dot gnu.org
  2023-10-10 19:08 ` rdapp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-09-21 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Reproduced locally.  The identical binary sometimes works and sometimes doesn't
so it must be a race...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/111428] RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90
  2023-09-15 20:26 [Bug target/111428] New: RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90 patrick at rivosinc dot com
  2023-09-21  7:06 ` [Bug target/111428] " juzhe.zhong at rivai dot ai
  2023-09-21 10:16 ` rdapp at gcc dot gnu.org
@ 2023-10-10 19:08 ` rdapp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-10-10 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Still difficult to track down.  The following is a smaller reproducer:

program main
  implicit none
  integer, parameter :: n=5, m=3
  integer, dimension(n,m) :: v
  real, dimension(n,m) :: r

  do
     call random_number(r)
     v = int(r * 2)
     if (count(v < 1) > 1) exit
  end do
  write (*,*) 'asdf'
end program main

I compiled libgfortran without vector but this doesn't change anything.  It's
really just the vectorization of that snippet but I haven't figured out why,
yet.  The stack before the random_number call looks identical.

Also tried valgrind which complains about compares dependent on uninitialized
data (those only show up once compiled with vectorization).  However I suspect
those are false negatives after chasing them for some hours.

Going to try another angle of attack.  Maybe it's a really simple thing I
overlooked.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-10 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 20:26 [Bug target/111428] New: RISC-V vector: Flaky segfault in {min|max}val_char_{1|2}.f90 patrick at rivosinc dot com
2023-09-21  7:06 ` [Bug target/111428] " juzhe.zhong at rivai dot ai
2023-09-21 10:16 ` rdapp at gcc dot gnu.org
2023-10-10 19:08 ` rdapp 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).