public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49949] New: wrong sign for product of complex<double> and double with -O2
@ 2011-08-02 19:19 begovic79 at gmail dot com
  2011-08-03  9:41 ` [Bug c++/49949] " rguenth at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: begovic79 at gmail dot com @ 2011-08-02 19:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49949

           Summary: wrong sign for product of complex<double> and double
                    with -O2
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: begovic79@gmail.com


With the -O2 flag and in a very specialized circumstance, the product of a
complex<double> and a double has the wrong sign.

The problem arises when the blitz++ array library is used.
(http://www.oonumerics.org/blitz/) Unfortunately, I could not prune out all the
references to the unnecessary C++ standard libraries. The size of the .ii file
is therefore pretty big. I hope the report will still be useful.

The output of the executable gcc_complex_bug should be

(-0.0,-1.0)x100.0=(0.0,100.0)

which shows the wrong sign for the product.

The following is the output of "g++ -v -save-temps -I. -O2 -o gcc_complex_bug
gcc_complex_bug.cpp"

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-I.' '-O2' '-o' 'gcc_complex_bug'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus -E -quiet -v -I.
-D_GNU_SOURCE gcc_complex_bug.cpp -D_FORTIFY_SOURCE=2 -mtune=generic
-march=x86-64 -O2 -fpch-preprocess -fstack-protector -o gcc_complex_bug.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/include/c++/4.5
 /usr/include/c++/4.5/x86_64-linux-gnu
 /usr/include/c++/4.5/backward
 /usr/local/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-I.' '-O2' '-o' 'gcc_complex_bug'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus -fpreprocessed
gcc_complex_bug.ii -quiet -dumpbase gcc_complex_bug.cpp -mtune=generic
-march=x86-64 -auxbase gcc_complex_bug -O2 -version -fstack-protector -o
gcc_complex_bug.s
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
    compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
    compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1a8763bcd4db37297f4ae8b8aab36cf0
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-I.' '-O2' '-o' 'gcc_complex_bug'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -V -Qy --64 -o gcc_complex_bug.o gcc_complex_bug.s
GNU assembler version 2.21.0 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.21.0.20110327
COMPILER_PATH=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../:/lib/:/usr/lib/:/usr/lib/x86_64-linux-gnu/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-I.' '-O2' '-o' 'gcc_complex_bug'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/collect2 --build-id
--eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -z relro -o gcc_complex_bug
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crt1.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crti.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtbegin.o
-L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2
-L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../..
-L/usr/lib/x86_64-linux-gnu gcc_complex_bug.o -lstdc++ -lm -lgcc_s -lgcc -lc
-lgcc_s -lgcc /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtend.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crtn.o


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-09-30 20:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 19:19 [Bug c++/49949] New: wrong sign for product of complex<double> and double with -O2 begovic79 at gmail dot com
2011-08-03  9:41 ` [Bug c++/49949] " rguenth at gcc dot gnu.org
2011-08-03 16:21 ` begovic79 at gmail dot com
2011-08-03 16:28 ` redi at gcc dot gnu.org
2011-08-03 16:33 ` begovic79 at gmail dot com
2011-08-03 16:34 ` begovic79 at gmail dot com
2011-09-28 15:11 ` paolo.carlini at oracle dot com
2011-09-28 15:36 ` paolo.carlini at oracle dot com
2011-09-28 15:58 ` hjl.tools at gmail dot com
2011-09-28 16:14 ` paolo.carlini at oracle dot com
2011-09-28 18:24 ` hjl.tools at gmail dot com
2011-09-29 15:29 ` paolo.carlini at oracle dot com
2011-09-29 15:40 ` paolo.carlini at oracle dot com
2011-09-30 16:57 ` hubicka at ucw dot cz
2011-09-30 20:49 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).