Bug#569436: Bug#571572: Bug#569436: blas: zgesvd seems to give incorrect results

Kumar Appaiah a.kumar at alumni.iitm.ac.in
Wed Mar 3 17:47:26 UTC 2010


Dear Denis,

On Wed, Mar 03, 2010 at 11:41:50AM +0100, Denis Barbier wrote:
> Hi,
> 
> For the record, thanks to the GCC compile farm, I determined that this
> bug has been fixed in gcc trunk by
>    http://gcc.gnu.org/viewcvs?view=revision&revision=145494
> Unfortunately this is a merge from a branch (alias-improvements) which
> is not mirrored by git, so I had not been able to run git-bisect on it
> to find the atomic commit.  And since this portion of code has been
> heavily modified, I doubt that it could be backported to gcc 4.4.  I
> do not know what can be done now.

I think we can still file a bug report. Could you please test the
attach test case, and let me know if it is reproducible? For me,
here's what I do:

[~/Kumar/Programming/Blas_test] gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.3-2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Debian 4.4.3-2)
$ make clean
rm -f zdrot_test.o zdrot.o zdrot_test
$ make
cc -c -O2 zdrot_test.c -o zdrot_test.o
gfortran -c -O2 -ftree-vectorize zdrot.f -o zdrot.o
cc   zdrot_test.o zdrot.o   -o zdrot_test
$ ./zdrot_test |tee 1
x: {(-0.8568, -0.0000), (-0.3505, -0.2082), (0.1505, 0.6113)}
y: {(0.4017, -0.0000), (-0.2403, -0.2102), (0.6074, 0.6064)}
$ make clean
rm -f zdrot_test.o zdrot.o zdrot_test
$ make FFLAGS=-O2
cc -c -O2 zdrot_test.c -o zdrot_test.o
gfortran -c -O2 zdrot.f -o zdrot.o
cc   zdrot_test.o zdrot.o   -o zdrot_test
$ ./zdrot_test |tee 2
x: {(-0.8568, -0.0000), (-0.3505, 0.1285), (0.1505, 0.3224)}
y: {(0.4017, -0.0000), (-0.2403, -0.2102), (0.6074, 0.6064)}
$ diff 1 2
1c1
< x: {(-0.8568, -0.0000), (-0.3505, -0.2082), (0.1505, 0.6113)}
---
> x: {(-0.8568, -0.0000), (-0.3505, 0.1285), (0.1505, 0.3224)}
$ 

I have attached the relevant files.

Thank you.

Kumar
-- 
To the guests that must go, bid God's speed and brush away all traces
of their steps.
- Rabindranath Tagore (The Gardener, 1915)
-------------- next part --------------
CFLAGS ?= -O2
FFLAGS ?= -O2 -ftree-vectorize
LFLAGS ?= -O3
FC = gfortran

all: zdrot_test

zdrot_test: zdrot.o zdrot_test.o

zdrot.o: zdrot.f
	$(FC) -c $(FFLAGS) $< -o $@

zdrot_test.o: zdrot_test.c
	$(CC) -c $(CFLAGS) $< -o $@

.PHONY: clean

clean:
	$(RM) zdrot_test.o zdrot.o zdrot_test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zdrot_test.c
Type: text/x-csrc
Size: 1419 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20100303/cf9a814a/attachment-0001.c>
-------------- next part --------------
      SUBROUTINE ZDROT( N, CX, INCX, CY, INCY, C, S )
*
*     .. Scalar Arguments ..
      INTEGER            INCX, INCY, N
      DOUBLE PRECISION   C, S
*     ..
*     .. Array Arguments ..
      COMPLEX*16         CX( * ), CY( * )
*     ..
*
*  Purpose
*  =======
*
*  Applies a plane rotation, where the cos and sin (c and s) are real
*  and the vectors cx and cy are complex.
*  jack dongarra, linpack, 3/11/78.
*
*  Arguments
*  ==========
*
*  N        (input) INTEGER
*           On entry, N specifies the order of the vectors cx and cy.
*           N must be at least zero.
*           Unchanged on exit.
*
*  CX       (input) COMPLEX*16 array, dimension at least
*           ( 1 + ( N - 1 )*abs( INCX ) ).
*           Before entry, the incremented array CX must contain the n
*           element vector cx. On exit, CX is overwritten by the updated
*           vector cx.
*
*  INCX     (input) INTEGER
*           On entry, INCX specifies the increment for the elements of
*           CX. INCX must not be zero.
*           Unchanged on exit.
*
*  CY       (input) COMPLEX*16 array, dimension at least
*           ( 1 + ( N - 1 )*abs( INCY ) ).
*           Before entry, the incremented array CY must contain the n
*           element vector cy. On exit, CY is overwritten by the updated
*           vector cy.
*
*  INCY     (input) INTEGER
*           On entry, INCY specifies the increment for the elements of
*           CY. INCY must not be zero.
*           Unchanged on exit.
*
*  C        (input) DOUBLE PRECISION
*           On entry, C specifies the cosine, cos.
*           Unchanged on exit.
*
*  S        (input) DOUBLE PRECISION
*           On entry, S specifies the sine, sin.
*           Unchanged on exit.
*
* =====================================================================
*
*     .. Local Scalars ..
      INTEGER            I, IX, IY
      COMPLEX*16         CTEMP
*     ..
*     .. Executable Statements ..
*
      IF( N.LE.0 )
     $   RETURN
      IF( INCX.EQ.1 .AND. INCY.EQ.1 )
     $   GO TO 20
*
*        code for unequal increments or equal increments not equal
*          to 1
*
      IX = 1
      IY = 1
      IF( INCX.LT.0 )
     $   IX = ( -N+1 )*INCX + 1
      IF( INCY.LT.0 )
     $   IY = ( -N+1 )*INCY + 1
      DO 10 I = 1, N
         CTEMP = C*CX( IX ) + S*CY( IY )
         CY( IY ) = C*CY( IY ) - S*CX( IX )
         CX( IX ) = CTEMP
         IX = IX + INCX
         IY = IY + INCY
   10 CONTINUE
      RETURN
*
*        code for both increments equal to 1
*
   20 CONTINUE
      DO 30 I = 1, N
         CTEMP = C*CX( I ) + S*CY( I )
         CY( I ) = C*CY( I ) - S*CX( I )
         CX( I ) = CTEMP
   30 CONTINUE
      RETURN
      END


More information about the debian-science-maintainers mailing list