From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27190 invoked by alias); 7 Apr 2009 15:29:50 -0000 Received: (qmail 26299 invoked by uid 48); 7 Apr 2009 15:29:26 -0000 Date: Tue, 07 Apr 2009 15:29:00 -0000 Message-ID: <20090407152926.26298.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00643.txt.bz2 ------- Comment #7 from rguenth at gcc dot gnu dot org 2009-04-07 15:29 ------- Minor data point (-O1 -g): movss 4(%rbx), %xmm3 movss (%rbx), %xmm2 movss (%rsp), %xmm1 movss 4(%rsp), %xmm0 call __mulsc3 Breakpoint 1, 0x00007ffff7667990 in __mulsc3 () from /lib64/libgcc_s.so.1 (gdb) p $xmm0 $1 = {v4_float = {4, 0, 0, 0}, v2_double = {5.3464347077054713e-315, 0}, v16_int8 = {0, 0, -128, 64, 0 }, v8_int16 = {0, 16512, 0, 0, 0, 0, 0, 0}, v4_int32 = {1082130432, 0, 0, 0}, v2_int64 = {1082130432, 0}, uint128 = 0x00000000000000000000000040800000} (gdb) p $xmm1 $2 = {v4_float = {2.24207754e-44, 0, 0, 0}, v2_double = { 7.9050503334599447e-323, 0}, v16_int8 = {16, 0 }, v8_int16 = {16, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {16, 0, 0, 0}, v2_int64 = { 16, 0}, uint128 = 0x00000000000000000000000000000010} (gdb) p $xmm2 $3 = {v4_float = {2, 0, 0, 0}, v2_double = {5.3049894774131808e-315, 0}, v16_int8 = {0, 0, 0, 64, 0 }, v8_int16 = {0, 16384, 0, 0, 0, 0, 0, 0}, v4_int32 = {1073741824, 0, 0, 0}, v2_int64 = {1073741824, 0}, uint128 = 0x00000000000000000000000040000000} (gdb) p $xmm3 $4 = {v4_float = {0, 0, 0, 0}, v2_double = {0, 0}, v16_int8 = { 0 }, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v2_int64 = {0, 0}, uint128 = 0x00000000000000000000000000000000} thus xmm1 is garbled. marking the specific std::transform always_inline fixes the issue. The arguments to that transform are already garbled: __unary_op= {, std::complex >> = {}, op = {, std::complex, std::complex >> = {}, }, value = {_M_value = 4 + -3.60319284e+33 * I} Marking std::bind2nd noinline makes it fail at -O2 as well, its arguments look good: (gdb) p __x $1 = (const std::complex &) @0x7fffffffde10: {_M_value = 4 + 0 * I} but its assembly looks weird: _ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_: .LFB1710: .file 1 "/usr/include/c++/4.4/backward/binders.h" .loc 1 164 0 .cfi_startproc .LVL0: .loc 1 167 0 movl (%rsi), %edx movl 4(%rsi), %eax movl %edx, -20(%rsp) movl %eax, -16(%rsp) .loc 1 168 0 movq -24(%rsp), %xmm0 ret so the error seems to be in the source or compilation of std::bind2nd >, std::complex > Paolo, can you provide an idea on how the result type of that looks like? (I'm lost in the headers ... ;)) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39678