Bug 143420

Summary: compiler optimizations cause wrong results
Product: [Fedora] Fedora Reporter: Simon Perreault <nomis80>
Component: lapackAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: petrosyan
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-27 09:12:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Simon Perreault 2004-12-20 17:27:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
Compiler optimizations make blas generate wrong results in at least
one function, izamax. When compiling with -O0, correct results are
generated, but anything above -O1 makes izamax behave slightly
differently than it should.

Version-Release number of selected component (if applicable):
blas-3.0-25

How reproducible:
Always

Steps to Reproduce:
1. Download the official testing program:
http://www.netlib.org/blas/zblat1 and save it to zblat1.f.

2. Compile the testing program and link with libblas:
g77 -o zblat1 zblat1.f -lblas

3. Run the test:
./zblat1

Actual Results:
   Complex BLAS Test Program Results


 Test of subprogram number  1            ZDOTC
                                    ----- PASS -----

 Test of subprogram number  2            ZDOTU
                                    ----- PASS -----

 Test of subprogram number  3            ZAXPY
                                    ----- PASS -----

 Test of subprogram number  4            ZCOPY
                                    ----- PASS -----

 Test of subprogram number  5            ZSWAP
                                    ----- PASS -----

 Test of subprogram number  6            DZNRM2
                                    ----- PASS -----

 Test of subprogram number  7            DZASUM
                                    ----- PASS -----

 Test of subprogram number  8            ZSCAL
                                    ----- PASS -----

 Test of subprogram number  9            ZDSCAL
                                    ----- PASS -----

 Test of subprogram number 10            IZAMAX
                                       FAIL

 CASE  N INCX INCY MODE                                COMP      TRUE
    DIFFERENCE

   10  4    1 9999 9999                                   3         2
          1
   10  4    2 9999 9999                                   3         2
          1


Expected Results:
   Complex BLAS Test Program Results


 Test of subprogram number  1            ZDOTC
                                    ----- PASS -----

 Test of subprogram number  2            ZDOTU
                                    ----- PASS -----

 Test of subprogram number  3            ZAXPY
                                    ----- PASS -----

 Test of subprogram number  4            ZCOPY
                                    ----- PASS -----

 Test of subprogram number  5            ZSWAP
                                    ----- PASS -----

 Test of subprogram number  6            DZNRM2
                                    ----- PASS -----

 Test of subprogram number  7            DZASUM
                                    ----- PASS -----

 Test of subprogram number  8            ZSCAL
                                    ----- PASS -----

 Test of subprogram number  9            ZDSCAL
                                    ----- PASS -----

 Test of subprogram number 10            IZAMAX
                                    ----- PASS -----


Additional info:

The problem lies with the dcabs1.f file. If only this file is compiled
with -O0, then the results are correct even with optimization.

The izamax routine searches a double-precision complex vector for the
item with the largest absolute value and returns its index. The two
cases that fail do so because of a comparison of (0.1,0.4) with
(0.4,0.1). The unoptimized version returns the index of the number
that comes first in the vector while the optimizations cause the index
of the last one to be returned instead. By looking at the code, I can
say that the correct behavior is indeed to return the first occurrence.

This is a compiler bug and should be forwarded as such. However, a
quick fix could be to compile dcabs1.f without optimizations.

Comment 2 Ivana Varekova 2004-12-21 14:13:32 UTC
Thank you for your notice.
The problem was fixed.
Ivana Varekova

Comment 3 petrosyan 2004-12-27 07:12:23 UTC
could you please release this as an update ?

without proper lapack libraries Fedora Core becomes useless for numerical
calculations.


Comment 4 Ivana Varekova 2004-12-27 09:12:30 UTC
Thank you for your notice.
Solved with -28, closing now.