hppa: Segmentation fault in c_sblat3 test
See: [(https://buildd.debian.org/status/fetch.php?pkg=lapack&arch=hppa&ver=3.12.1-4&stamp=1753202248&raw=0)]
dave@mx3210:~/debian/lapack/lapack-3.12.1/CBLAS/testing$ gdb -c core.25930 ./xscblat3 GNU gdb (Debian 16.3-1) 16.3 Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "hppa-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./xscblat3...
[New LWP 25930]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/hppa-linux-gnu/libthread_db.so.1".
Core was generated by `./xscblat3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00013d1c in smake (type=..., uplo=..., diag=..., m=
This fault occurs in the SCHK6 test. The array IDIM is clobbered by the memcpy call used to implement this loop in the SCHK6 test:
DO 30 I = 1, LCC
CS( I ) = CC( I )
30 CONTINUE LDCS = LDC
I believe this is caused by a mismatch between the callee arguments for SCHK6
185 IF (CORDER) THEN CALL SCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE, $ REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, $ NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W, $ 0 )
END IF
IF (RORDER) THEN
CALL SCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
$ REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,
$ NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W,
$ 1 )
END IF
and the implementation
SUBROUTINE SCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
$ FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,
$ A, AA, AS, B, BB, BS, C, CC, CS, CT, G,
$ IORDER)
Argument "B" is dropped and argument "W" is added to keep the number of REAL arguments the same. I'm not sure why this inconsistency is not detected by gcc. Maybe "-Wall" is needed.
If SCHK6 test is skipped, lapack builds successfully on hppa.
Checklist
- [ ] I've included a minimal example to reproduce the issue
- [ ] I'd be willing to make a PR to solve this issue
It appears alpha is affected by the same bug.
Hi @danglin44, can you send the lines of codes using "permalink" features of GitHub. Something like https://github.com/Reference-LAPACK/lapack/blob/bfbef596de9c445075b809f127e85c379884e209/BLAS/TESTING/sblat3.f#L344-L347 I cannot identify the lines of codes you are pointing you. Cheers, @langou
Found it! https://github.com/Reference-LAPACK/lapack/blob/bfbef596de9c445075b809f127e85c379884e209/CBLAS/testing/c_sblat3.f#L365-L369 This was in CBLAS not BLAS, my bad.