This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/64677] New: incorrect result with complex division?


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64677

            Bug ID: 64677
           Summary: incorrect result with complex division?
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: spatel at rotateright dot com

I'm not sure if this is a bug at -O0, at -O1 (in MPFR because all math is
folded out in this case?), or neither:

#include <complex>
#include <iostream>
#include <iomanip>

int main()
{
    std::complex<double> c(-61.887073591767951,-60.052083270252012);
    double a = (1.0 / c).real();

    std::cout << std::setprecision(17) << " " << a << std::endl;
}

$ g++ complex_div.cpp -O0 -std=c++11
$ ./a.out 
 -0.0083223357032193145
$ g++ complex_div.cpp -O1 -std=c++11
$ ./a.out 
 -0.0083223357032193128


Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.10.0' '-O1' '-std=c++11' '-v'
'-shared-libgcc' '-mtune=core2'
 /usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/cc1plus -quiet -v
-D__DYNAMIC__ 22241.cpp -fPIC -quiet -dumpbase 22241.cpp
-mmacosx-version-min=10.10.0 -mtune=core2 -auxbase 22241 -O1 -std=c++11
-version -o /var/folders/k1/5fqvbm0n1zj6kjp0s9p18rm40000gn/T//ccaWfRcp.s
GNU C++ (GCC) version 4.9.2 20141029 (prerelease) (x86_64-apple-darwin14.0.0)
    compiled by GNU C version 4.9.2 20141029 (prerelease), GMP version 6.0.0,
MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../../x86_64-apple-darwin14.0.0/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/

/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../../include/c++/4.9.2

/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../../include/c++/4.9.2/x86_64-apple-darwin14.0.0

/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../../include/c++/4.9.2/backward
 /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include
 /usr/local/include
 /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
GNU C++ (GCC) version 4.9.2 20141029 (prerelease) (x86_64-apple-darwin14.0.0)
    compiled by GNU C version 4.9.2 20141029 (prerelease), GMP version 6.0.0,
MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c0a1d89bdb8ef292bcb2f0d5b923240f
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.10.0' '-O1' '-std=c++11' '-v'
'-shared-libgcc' '-mtune=core2'
 as -arch x86_64 -force_cpusubtype_ALL -o
/var/folders/k1/5fqvbm0n1zj6kjp0s9p18rm40000gn/T//ccOTSBAQ.o
/var/folders/k1/5fqvbm0n1zj6kjp0s9p18rm40000gn/T//ccaWfRcp.s
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/:/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/:/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/:/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/
LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/:/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.10.0' '-O1' '-std=c++11' '-v'
'-shared-libgcc' '-mtune=core2'
 /usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/collect2 -dynamic -arch
x86_64 -macosx_version_min 10.10.0 -weak_reference_mismatches non-weak -o a.out
-L/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2
-L/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../..
/var/folders/k1/5fqvbm0n1zj6kjp0s9p18rm40000gn/T//ccOTSBAQ.o -lstdc++
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
collect2 version 4.9.2 20141029 (prerelease)
/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.10.0
-weak_reference_mismatches non-weak -o a.out
-L/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2
-L/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../..
/var/folders/k1/5fqvbm0n1zj6kjp0s9p18rm40000gn/T//ccOTSBAQ.o -lstdc++
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-241.9
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h
armv6m armv7m armv7em
Library search paths:
    /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2
    /usr/local/lib
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]