Bug 142603 - g++ with optimization -O and above breaks at complex NaNs
Summary: g++ with optimization -O and above breaks at complex NaNs
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc   
(Show other bugs)
Version: 3
Hardware: i386 Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-12-10 20:50 UTC by Dmitri A. Sergatskov
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version: 3.4.3-10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-14 21:05:17 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Dmitri A. Sergatskov 2004-12-10 20:50:36 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:
If I compiling the following code with "-O" flag or above the
resulting code
hangs forever. Code compiled with no optimization works as expected.

#include <complex>
#include <iostream>

int main()
{
  std::complex<double> z1(1.0/0.0,-1.0/0.0);
  std::complex<double> z2 = std::sqrt(z1);
  std::complex<double> z3 = std::sqrt(z2);

  std::cout
        << "z1: " << z1 << std::endl
        << "z2: " << z2 << std::endl
        << "z3: " << z3 << std::endl;
  return 0;
}


Version-Release number of selected component (if applicable):
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

How reproducible:
Always

Steps to Reproduce:
1. Compile the code with "g++ -O"
2. Run resulting program
3.
    

Actual Results:  It hangs

Expected Results:  z1: (inf,-inf)
z2: (nan,nan)
z3: (nan,nan)


Additional info:

The code works as expected with gcc version 3.2.2 20030222 (Red Hat
Linux 3.2.2-5).

Comment 2 Jakub Jelinek 2004-12-14 21:05:17 UTC
Should be fixed in gcc-3.4.3-10 in rawhide.

Comment 3 Dmitri A. Sergatskov 2004-12-16 00:59:04 UTC
 gcc-3.4.3-10 works for me too. Thank you for fast responce!


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