Skip to content

hppa: Segmentation fault in c_sblat3 test #1151

@danglin44

Description

@danglin44

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=,
n=, a=..., nmax=, aa=...,
--Type for more, q to quit, c to continue without paging--
lda=, reset=, transl=,
_type=, _uplo=, _diag=)
at c_sblat3.f:2182
2182 AA( I + ( J - 1 )*LDA ) = ROGUE
(gdb) bt
#0 0x00013d1c in smake (type=..., uplo=..., diag=..., m=,
n=, a=..., nmax=, aa=...,
lda=, reset=, transl=,
_type=, _uplo=, _diag=)
at c_sblat3.f:2182
#1 0x00014394 in schk6 (sname=..., eps=,
thresh=,
nout=<error reading variable: Cannot access memory at address 0xbdbe4613>,
ntra=, trace=, rewi=,
fatal=, nidim=, idim=...,
nalf=, alf=..., nbet=, bet=...,
nmax=, a=..., aa=..., as=..., b=..., bb=..., bs=..., c=...,
cc=..., cs=..., ct=..., g=..., iorder=,
_sname=) at c_sblat3.f:2624
#2 0x0001e7b8 in sblat3 () at c_sblat3.f:369

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions