Public bug reported:

1. Ubuntu release

No LSB modules are available.
Description:    Ubuntu 24.04.1 LTS
Release:        24.04

2. Package version

libopenblas0:
  Installed: 0.3.26+ds-1
  Candidate: 0.3.26+ds-1
  Version table:
 *** 0.3.26+ds-1 500
        500 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 Packages
        100 /var/lib/dpkg/status

gcc-13:
  Installed: 13.2.0-23ubuntu4
  Candidate: 13.2.0-23ubuntu4
  Version table:
 *** 13.2.0-23ubuntu4 500
        500 http://us.archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status

3. I compiled the following c++ program with "g++ -o test_blas
test_blas.cpp -lopenblas"

#include <iostream>
#include <complex>

#include <fenv.h>

typedef std::complex<double> dcomp;

extern "C" {
void zrotg_(dcomp*, dcomp*, double*, dcomp*);
}

int main(void) {
    feenableexcept(FE_INVALID   | 
                   FE_DIVBYZERO | 
                   FE_OVERFLOW  | 
                   FE_UNDERFLOW);    
    
    dcomp ain(0.28048120941867205058,0.028460086243503417841), 
bin(0.018279187257355982571,0);
    double c(0.0);
    dcomp s(0.0);

    dcomp a=ain, b=bin;
    zrotg_(&a, &b, &c, &s);
    std::cout << a << " " << b << " " << c << " " << s << std::endl;

    return 0;
}
              
Expected output:

(0.28107,0.101469) (0.0182792,0) 0.997905 (0.0643715,0.0065317)

4. What happened:

Output with -O3:
Floating point exception (core dumped)

Output with -O3 but FPE turned off:
(0.28107,inf) (0.0182792,0) 0.997905 (0.0643715,0.0065317)

This could be an issue with gcc as well, but I'm at a loss to understand
how the optimization level would affect the behavior of zrotg. I tried
to take a look in godbolt and saw that it clearly does something very
different with -O3 but I don't understand assembly very well. This
program executes successfully with -O3 and a recent Intel compiler +
MKL.

** Affects: openblas (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2083157

Title:
  FPE in zrotg with g++-13 -O3

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openblas/+bug/2083157/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to