Bug description: Function *int gsl_spmatrix_transpose_memcpy(gsl_spmatrix * dest, const gsl_spmatrix * src)* is in error when *dest *matrix has data. This can be solved by setting such matrix to zero, which is not expected when copying from another matrix. Included is a program that exercises the bug; both matrices are read from the same text file, also included.
Version: GSL 2.6 Operating System: openSUSE Tumbleweed 20210316 Kernel Version: 5.11.6-1-default OS Type: 64-bit Processors: 8 × Intel Core i7-4700MQ CPU @ 2.40GHz Memory: 15.6 GiB of RAM GCC version output: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/10/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecd ir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d --enable-offload-targets=nvptx-none,amdgcn-amdhsa, --wi thout-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/10 --enable-ssp --disab le-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/ --wit h-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-li nux-futex --enable-gnu-indirect-function --program-suffix=-10 --without-system-libunwind --enable-multilib --with-arch-32=x8 6-64 --with-tune=generic --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=x86_64-suse-linux --host=x86_64- suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.1 20210303 [revision 85977f624a34eac309f9d77a58164553dfc82975] (SUSE Linux)
%%MatrixMarket matrix coordinate real general 10 10 29 1 1 0.512715 1 3 -0.573381 1 5 -0.554339 1 10 -0.182682 2 1 0.017813 2 4 0.038843 2 6 -0.530746 3 1 0.003955 3 9 0.004335 4 1 0.003606 4 8 -0.882346 4 9 -0.500247 5 1 0.005460 5 2 -0.795750 6 4 -0.014964 6 6 -0.471448 6 9 0.002911 7 6 -0.486331 8 9 -0.005600 8 10 -0.004274 9 1 -0.285678 9 5 -0.014556 9 8 -0.578607 9 9 -0.799267 10 5 0.237258 10 6 -0.384919 10 8 -0.000760 10 9 0.011178 10 10 -0.014409
#include <stdlib.h> #include <gsl/gsl_spmatrix.h> int main ( int argc, char** argv ) { gsl_spmatrix * C, * D; FILE * f1, *f2; f1 = fopen("matrix.txt", "r"); f2 = fopen("matrix.txt", "r"); C = gsl_spmatrix_fscanf(f1); D = gsl_spmatrix_fscanf(f2); fclose(f1); fclose(f2); gsl_spmatrix_transpose_memcpy (C, D); gsl_spmatrix_free(C); gsl_spmatrix_free(D); return 0; } // ///