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).
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00917.html
Should be fixed in gcc-3.4.3-10 in rawhide.
gcc-3.4.3-10 works for me too. Thank you for fast responce!