🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gmane.comp.gcc.bugs
6 messages
6 total messages Started by "abelk at live d Wed, 26 Jan 2011 11:10
[Bug c/47473] New: Incorrect computation with complex numbers when using -stdÉ9
#307958
Author: "abelk at live d
Date: Wed, 26 Jan 2011 11:10
107 lines
4855 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

           Summary: Incorrect computation with complex numbers when using
                    -stdÉ9
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abelk@live.com


Created attachment 23131
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id#131
complexbug3.i

This is a report about an issue encountered in MinGW GCC. The maintainers of
the MinGW project suggested to report it here.

The command line that triggers the bug is:

gcc -v -save-temps -Wall -stdÉ9 complexbug3.c -o complexbug3.exe

The option -stdÉ9 triggers the bug.

The resultant output is:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/program
files/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.0/configure
--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions
--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --enable-version-specific-runtime-libs
--disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.0 (GCC)
COLLECT_GCC_OPTI '-save-temps' '-Wall' '-stdÉ9' '-o'
'complexbug3.exe' '-mtune=i386' '-march=i386'
 c:/program files/mingw/bin/../libexec/gcc/mingw32/4.5.0/cc1.exe -E -quiet -v
-iprefix c:\program files\mingw\bin\../lib/gcc/mingw32/4.5.0/ complexbug3.c
-mtune=i386 -march=i386 -stdÉ9 -Wall -fpch-preprocess -o complexbug3.i
ignoring nonexistent directory "c:\program
files\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../mingw32/include"
ignoring nonexistent directory "c:/mingw/include"
ignoring nonexistent directory "/mingw/include"
ignoring duplicate directory "c:/program
files/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.0/include"
ignoring duplicate directory "c:/program
files/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.0/include-fixed"
ignoring nonexistent directory "c:/program
files/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.0/../../../../mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\program files\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include
 c:\program files\mingw\bin\../lib/gcc/mingw32/4.5.0/include
 c:\program files\mingw\bin\../lib/gcc/mingw32/4.5.0/include-fixed
End of search list.
COLLECT_GCC_OPTI '-save-temps' '-Wall' '-stdÉ9' '-o'
'complexbug3.exe' '-mtune=i386' '-march=i386'
 c:/program files/mingw/bin/../libexec/gcc/mingw32/4.5.0/cc1.exe -fpreprocessed
complexbug3.i -quiet -dumpbase complexbug3.c -mtune=i386 -march=i386 -auxbase
complexbug3 -Wall -stdÉ9 -version -o complexbug3.s
GNU C (GCC) version 4.5.0 (mingw32)
    compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.1, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand0 --param ggc-min-heapsize1072
GNU C (GCC) version 4.5.0 (mingw32)
    compiled by GNU C version 4.5.0, GMP version 5.0.1, MPFR version 2.4.1, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand0 --param ggc-min-heapsize1072
Compiler executable checksum: 6773400e8bc9df4b012089071ac4c86b
COLLECT_GCC_OPTI '-save-temps' '-Wall' '-stdÉ9' '-o'
'complexbug3.exe' '-mtune=i386' '-march=i386'
 c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/as.exe -o
complexbug3.o complexbug3.s
COMPILER_PATH=c:/program
files/mingw/bin/../libexec/gcc/mingw32/4.5.0/;c:/program
files/mingw/bin/../libexec/gcc/;c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/
LIBRARY_PATH=c:/program files/mingw/bin/../lib/gcc/mingw32/4.5.0/;c:/program
files/mingw/bin/../lib/gcc/;c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/lib/;c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../
COLLECT_GCC_OPTI '-save-temps' '-Wall' '-stdÉ9' '-o'
'complexbug3.exe' '-mtune=i386' '-march=i386'
 c:/program files/mingw/bin/../libexec/gcc/mingw32/4.5.0/collect2.exe -Bdynamic
-o complexbug3.exe c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../crt2.o c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/crtbegin.o -Lc:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0 -Lc:/program
files/mingw/bin/../lib/gcc -Lc:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/lib -Lc:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/../../.. complexbug3.o -lmingw32
-lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32
-lshell32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt c:/program
files/mingw/bin/../lib/gcc/mingw32/4.5.0/crtend.o


The result of executing complexbug3.exe is mathematically incorrect:
(0.2 - I*0.3)*(0.3 - I*0.9) = (0.06, -0.09)
[Bug target/47473] [4.5/4.6 Regression] Incorrect computation with complex numbers when using -stdÉ9
#307959
Author: "rguenth at gcc
Date: Wed, 26 Jan 2011 11:26
23 lines
1283 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i?86-*-*
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.4.4
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2011.01.26 11:26:29
          Component|c                           |target
     Ever Confirmed|0                           |1
            Summary|Incorrect computation with  |[4.5/4.6 Regression]
                   |complex numbers when using  |Incorrect computation with
                   |-stdÉ9                    |complex numbers when using
                   |                            |-stdÉ9
   Target Milestone|---                         |4.5.3
      Known to fail|                            |4.5.0, 4.5.2, 4.6.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-26 11:26:29 UTC ---
Confirmed on i?86-linux.  Seems to be a problem with libgcc __mulxc3, linking
with the libgcc from 4.4 makes it work for the failing releases.
[Bug target/47473] [4.5/4.6 Regression] Incorrect computation with complex numbers when using -stdÉ9
#307973
Author: "jakub at gcc do
Date: Wed, 26 Jan 2011 13:43
25 lines
814 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-26 13:42:50 UTC ---
Unincluded testcase:
int
main (void)
{
 long double _Complex w = 0.2L - 0.3iL;
  w = w * (0.3L - (0.0F + 1.0iF) * 0.9L);
  __builtin_printf("(0.2 - I*0.3)*(0.3 - I*0.9) = (%g, %g)\n", (double)
__real__ w, (double) __imag__ w);
  return 0;
}

On x86_64-linux the results look correct.
Using
w = w * (0.3L - 0.9iL);
instead works too.  And the results I get don't depend on libgcc version used
(4.4 behaves like 4.6).
[Bug c/47473] [4.5/4.6 Regression] Incorrect computation with complex numbers when using -stdÉ9
#307995
Author: "jakub at gcc do
Date: Wed, 26 Jan 2011 15:10
13 lines
563 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|target                      |c
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-26 15:10:07 UTC ---
Mine.
[Bug c/47473] [4.5/4.6 Regression] Incorrect computation with complex numbers when using -stdÉ9
#307996
Author: "hjl.tools at gm
Date: Wed, 26 Jan 2011 15:14
6 lines
222 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-26 15:14:10 UTC ---
It is caused by revision 147281:

http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00255.html
[Bug c/47473] [4.5/4.6 Regression] Incorrect computation with complex numbers when using -stdÉ9
#307997
Author: "jakub at gcc do
Date: Wed, 26 Jan 2011 15:20
8 lines
258 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG473

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-26 15:19:56 UTC ---
Created attachment 23132
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id#132
gcc46-pr47473.patch

Untested fix.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads