Bug 143420 - compiler optimizations cause wrong results
compiler optimizations cause wrong results
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: lapack (Show other bugs)
3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Ivana Varekova
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-20 12:27 EST by Simon Perreault
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-27 04:12:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Simon Perreault 2004-12-20 12:27:10 EST
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 09:13:32 EST
Thank you for your notice.
The problem was fixed.
Ivana Varekova
Comment 3 petrosyan 2004-12-27 02:12:23 EST
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 04:12:30 EST
Thank you for your notice.
Solved with -28, closing now.

Note You need to log in before you can comment on or make changes to this bug.