public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39678]  New: std::transform is incorrect with std::multiples and bind2nd for complex<float>
@ 2009-04-07 13:50 diepen at astron dot nl
  2009-04-07 13:54 ` [Bug c++/39678] " paolo dot carlini at oracle dot com
                   ` (34 more replies)
  0 siblings, 35 replies; 36+ messages in thread
From: diepen at astron dot nl @ 2009-04-07 13:50 UTC (permalink / raw)
  To: gcc-bugs

The code shown below works nicely when compiled with -O2 or -O2 -g.
However, it fails when compiled with -g, but only for std::complex<float>. For
the other types it works well. Valgrind gives piles of uninitialized value
errors.
The same results are obtained when building on other Linux platforms. Also hen
using bind1st the same problems arise.
It works well with g++-3.4.3 though.

Cheers,
Ger


#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>

template<typename TYPE>
void testIt()
{
  std::vector<TYPE> vecc(2, TYPE(2.));
  std::vector<TYPE> result(2);
  // Test vector * scalar.
  std::transform (vecc.begin(), vecc.end(), result.begin(),
                  bind2nd(std::multiplies<TYPE>(), TYPE(5.)));
  std::cout << result[0] << ' ' << result[1] << std::endl;
}

int main()
{
  testIt<double>();
  testIt<float>();
  testIt<std::complex<float> >();
  testIt<std::complex<double> >();
}


-- 
           Summary: std::transform is incorrect with std::multiples and
                    bind2nd for complex<float>
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: diepen at astron dot nl
 GCC build triplet: c++ -Wall  -g tac.cc
  GCC host triplet: Linux dop131 2.6.27.19-3.2-default #1 SMP 2009-02-25
                    15:40:44 +0
GCC target triplet: same


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


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

* [Bug c++/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
@ 2009-04-07 13:54 ` paolo dot carlini at oracle dot com
  2009-04-07 14:03 ` diepen at astron dot nl
                   ` (33 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-04-07 13:54 -------
Explain what do you mean by "fails".


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


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

* [Bug c++/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
  2009-04-07 13:54 ` [Bug c++/39678] " paolo dot carlini at oracle dot com
@ 2009-04-07 14:03 ` diepen at astron dot nl
  2009-04-07 14:18 ` paolo dot carlini at oracle dot com
                   ` (32 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: diepen at astron dot nl @ 2009-04-07 14:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from diepen at astron dot nl  2009-04-07 14:03 -------
The output does not show the correct results. It looks as if the imaginary part
of the complex number in the bind2nd object is incorrect. When debugging the
bind2nd object was constructed correctly, but when used in std::transform its
value was incorrect, in particular the imaginary part seems to be uninitialized
(as also reported by valgrind). As I said, this only happens for
complex<float>, not for complex<double>.

Originally I used my own Multiplies functor to multiply a float vector with a
complex<float> value and that failed similarly. But it appears to happen for
the simpler case as shown in my test program too. 


-- 


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


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

* [Bug c++/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
  2009-04-07 13:54 ` [Bug c++/39678] " paolo dot carlini at oracle dot com
  2009-04-07 14:03 ` diepen at astron dot nl
@ 2009-04-07 14:18 ` paolo dot carlini at oracle dot com
  2009-04-07 14:24 ` paolo dot carlini at oracle dot com
                   ` (31 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 14:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2009-04-07 14:17 -------
Yes, you are right. Apparently some sort of miscompilation. The problem does
not happen when using the C++ runtime + a different C++ compiler, by the way.
Let's look further into it... The other possibility is that you are triggering
somehow an undefined behavior...


-- 


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


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

* [Bug c++/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (2 preceding siblings ...)
  2009-04-07 14:18 ` paolo dot carlini at oracle dot com
@ 2009-04-07 14:24 ` paolo dot carlini at oracle dot com
  2009-04-07 14:51 ` [Bug target/39678] " rguenth at gcc dot gnu dot org
                   ` (30 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 14:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2009-04-07 14:23 -------
Richard, can I have your opinion about this? Thanks in advance!


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (3 preceding siblings ...)
  2009-04-07 14:24 ` paolo dot carlini at oracle dot com
@ 2009-04-07 14:51 ` rguenth at gcc dot gnu dot org
  2009-04-07 15:04 ` paolo dot carlini at oracle dot com
                   ` (29 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 14:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2009-04-07 14:51 -------
The expected output is

10 10
10 10
(10,0) (10,0)
(10,0) (10,0)

correct?  With -O0 I get

10 10
10 10
(nan,nan) (nan,nan)
(10,0) (10,0)

while for -m32 it is ok.  So it appears only the float variant is affected?
Thus, reduced testcase:

#include <vector>
#include <algorithm>
#include <complex>

extern "C" void abort(void);

int main()
{
  std::vector<std::complex<float> > vecc(2, std::complex<float>(2.));
  std::vector<std::complex<float> > result(2);
  // Test vector * scalar.
  std::transform (vecc.begin(), vecc.end(), result.begin(),
                  bind2nd(std::multiplies<std::complex<float> >(),
std::complex<float>(4.)));
  if (result[0].real() != 8.
      || result[0].imag() != 0.
      || result[1].real() != 8.
      || result[1].imag() != 0.)
    abort ();
  return 0;
}

fails for me at -O0 and -O1 in 64bits.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |target
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.3.3 4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-07 14:51:42
               date|                            |


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (4 preceding siblings ...)
  2009-04-07 14:51 ` [Bug target/39678] " rguenth at gcc dot gnu dot org
@ 2009-04-07 15:04 ` paolo dot carlini at oracle dot com
  2009-04-07 15:29 ` rguenth at gcc dot gnu dot org
                   ` (28 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 15:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from paolo dot carlini at oracle dot com  2009-04-07 15:04 -------
Agreed, thanks Richard.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo at gcc dot gnu dot org


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (5 preceding siblings ...)
  2009-04-07 15:04 ` paolo dot carlini at oracle dot com
@ 2009-04-07 15:29 ` rguenth at gcc dot gnu dot org
  2009-04-07 15:33 ` paolo dot carlini at oracle dot com
                   ` (27 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 15:29 UTC (permalink / raw)
  To: gcc-bugs



------- 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 <repeats 12 times>}, 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 <repeats 15 times>}, 
  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 <repeats 12 times>}, 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 <repeats 16 times>}, 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::unary_function<std::complex<float>, std::complex<float> >> =
{<No data fields>}, op = {<std::binary_function<std::complex<float>,
std::complex<float>, std::complex<float> >> = {<No data fields>}, <No data
fields>}, 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<float> &) @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::multiplies<std::complex<float> >, std::complex<float> >

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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (6 preceding siblings ...)
  2009-04-07 15:29 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 15:33 ` paolo dot carlini at oracle dot com
  2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
                   ` (26 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from paolo dot carlini at oracle dot com  2009-04-07 15:32 -------
Ok, give me a few minutes, I'm going to dig a bit further...


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (8 preceding siblings ...)
  2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
  2009-04-07 15:47 ` rguenth at gcc dot gnu dot org
                   ` (24 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2009-04-07 15:45 -------
It seems to be an ABI mismatch in the backend somehow.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|c++ -Wall  -g tac.cc        |
   GCC host triplet|Linux dop131 2.6.27.19-3.2- |
                   |default #1 SMP 2009-02-25   |
                   |15:40:44 +0                 |
           Keywords|                            |ABI


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (7 preceding siblings ...)
  2009-04-07 15:33 ` paolo dot carlini at oracle dot com
@ 2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
  2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
                   ` (25 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2009-04-07 15:44 -------
Wait - it's ok.

    class binder2nd
    : public unary_function<typename _Operation::first_argument_type,
       typename _Operation::result_type>
    {
    protected:
      _Operation op;
      typename _Operation::second_argument_type value;

_Operation is probably empty, so there are 4 bytes padding and the struct
is returned in a xmm0

(gdb) p $xmm0
$5 = {v4_float = {-9.04046813e+33, 4, 0, 0}

but we access the result like

        call   
_ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_
        movl    72(%rsp), %edx
        movq    %xmm0, 8(%rsp)
        movq    8(%rsp), %rax
        movl    %edx, 88(%rsp)
        movq    %rax, 80(%rsp)
        movss   88(%rsp), %xmm5
        movq    %rax, 64(%rsp)
        movss   84(%rsp), %xmm4
        movq    %rax, 96(%rsp)
        movl    %edx, 104(%rsp)
        .loc 5 1144 0
        movaps  %xmm4, %xmm0
        movaps  %xmm5, %xmm1
        movss   4(%rbx), %xmm3
        movss   (%rbx), %xmm2
        movss   %xmm4, 32(%rsp)
        movss   %xmm5, 16(%rsp)
        call    __mulsc3
        movq    %xmm0, 56(%rsp)
        movl    56(%rsp), %eax
        movl    60(%rsp), %edx


so you can see we simply use the lower 8 bytes of %xmm0 only ...
(supposedly thinking that the other half got loaded to %edx).

It's already broken at expansion:

(call_insn 67 66 68 11 t.C:13 (set (parallel:BLK [
                (expr_list:REG_DEP_TRUE (reg:DI 21 xmm0)
                    (const_int 0 [0x0]))
            ])
        (call (mem:QI (symbol_ref/i:DI
("_ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_")
[flags 0x1] <function_decl 0x7ffff4887d00 bind2nd>) [0 S1 A8])
            (const_int 0 [0x0]))) -1 (expr_list:REG_EH_REGION (const_int 0
[0x0])
        (nil))
    (expr_list:REG_DEP_TRUE (use (reg:DI 5 di))
        (expr_list:REG_DEP_TRUE (use (reg:DI 4 si))
            (nil))))

(insn 68 67 69 11 t.C:13 (set (reg:DI 92)
        (reg:DI 21 xmm0)) -1 (nil))


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|same                        |x86_64-*-*


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (9 preceding siblings ...)
  2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 15:47 ` rguenth at gcc dot gnu dot org
  2009-04-07 15:48 ` paolo dot carlini at oracle dot com
                   ` (23 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2009-04-07 15:46 -------
Created an attachment (id=17603)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17603&action=view)
preprocessed testcase with bind2nd marked noinline

Testcase, look at the compiled piece for the call to
_ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_

(which is marked noinline here).


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (10 preceding siblings ...)
  2009-04-07 15:47 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 15:48 ` paolo dot carlini at oracle dot com
  2009-04-07 15:57 ` rguenth at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from paolo dot carlini at oracle dot com  2009-04-07 15:48 -------
You are too fast ;)


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (11 preceding siblings ...)
  2009-04-07 15:48 ` paolo dot carlini at oracle dot com
@ 2009-04-07 15:57 ` rguenth at gcc dot gnu dot org
  2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from rguenth at gcc dot gnu dot org  2009-04-07 15:57 -------
The intel compiler generates

..___tag_value__ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_.69:
#165.5
        movq      (%rsi), %rax                                  #167.53
        movss     4(%rsi), %xmm1                                #167.53
        movq      %rax, -20(%rsp)                               #167.42
        movsd     -24(%rsp), %xmm0                              #167.14
..___tag_value__ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_.70:
#167.14
        ret                                                

and

        call     
_ZSt7bind2ndISt10multipliesISt7complexIfEES2_ESt9binder2ndIT_ERKS5_RKT0_ #13.68
                                # LOE rbx r12 r13 xmm0 xmm1
..B1.35:                        # Preds ..B1.11
        movlps    %xmm0, 48(%rsp)                               #13.68
        movss     %xmm1, 56(%rsp)                

so it's at least consistent ....


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (13 preceding siblings ...)
  2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
  2009-04-07 16:24 ` paolo dot carlini at oracle dot com
                   ` (19 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from rguenth at gcc dot gnu dot org  2009-04-07 16:04 -------
With a small testcase it works:

struct Y {};
struct X {
  Y y;
  float real;
  float imag;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  x.real = p[0];
  x.imag = p[1];
  return x;
}
extern "C" void abort (void);
int main()
{
  float a[2] = { 1., 2. };
  struct X x = foo(a);
  if (x.real != 1.
      || x.imag != 2.)
    abort ();
  return 0;
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.1.3 4.2.5 4.3.3 4.4.0     |4.3.3 4.4.0


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (12 preceding siblings ...)
  2009-04-07 15:57 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
  2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-07 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from rguenth at gcc dot gnu dot org  2009-04-07 16:05 -------
So maybe it's a C++ FE issue after all ...


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (14 preceding siblings ...)
  2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
@ 2009-04-07 16:24 ` paolo dot carlini at oracle dot com
  2009-04-07 16:45 ` paolo dot carlini at oracle dot com
                   ` (18 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 16:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from paolo dot carlini at oracle dot com  2009-04-07 16:24 -------
Sorry for the noise, forgot that we don't care any more about 4_1 and 4_2 ;)
Anyway, the issue is apparently *very* old...


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (15 preceding siblings ...)
  2009-04-07 16:24 ` paolo dot carlini at oracle dot com
@ 2009-04-07 16:45 ` paolo dot carlini at oracle dot com
  2009-04-07 19:01 ` paolo dot carlini at oracle dot com
                   ` (17 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 16:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from paolo dot carlini at oracle dot com  2009-04-07 16:44 -------
I guess I'm going to reduce the big one with 'delta', if you have special
advice about that, just let me know...


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (16 preceding siblings ...)
  2009-04-07 16:45 ` paolo dot carlini at oracle dot com
@ 2009-04-07 19:01 ` paolo dot carlini at oracle dot com
  2009-04-07 20:47 ` paolo dot carlini at oracle dot com
                   ` (16 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 19:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from paolo dot carlini at oracle dot com  2009-04-07 19:01 -------
Created an attachment (id=17604)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17604&action=view)
A bit smaller


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (17 preceding siblings ...)
  2009-04-07 19:01 ` paolo dot carlini at oracle dot com
@ 2009-04-07 20:47 ` paolo dot carlini at oracle dot com
  2009-04-07 22:04 ` paolo dot carlini at oracle dot com
                   ` (15 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 20:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from paolo dot carlini at oracle dot com  2009-04-07 20:47 -------
Created an attachment (id=17605)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17605&action=view)
Smaller...


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (18 preceding siblings ...)
  2009-04-07 20:47 ` paolo dot carlini at oracle dot com
@ 2009-04-07 22:04 ` paolo dot carlini at oracle dot com
  2009-04-08  8:40 ` rguenth at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-07 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from paolo dot carlini at oracle dot com  2009-04-07 22:04 -------
Created an attachment (id=17606)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17606&action=view)
Even closer to minimal (as C++ code) and more correct


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (19 preceding siblings ...)
  2009-04-07 22:04 ` paolo dot carlini at oracle dot com
@ 2009-04-08  8:40 ` rguenth at gcc dot gnu dot org
  2009-04-08  9:11 ` paolo dot carlini at oracle dot com
                   ` (13 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-08  8:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from rguenth at gcc dot gnu dot org  2009-04-08 08:39 -------
Ah, the key is the complex type!  Thus, the following testcase "works"

struct Y {};
struct X {
  Y y;
  __complex__ float val;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  __real x.val = p[0];
  __imag x.val = p[1];
  return x;
}
extern "C" void abort (void);
int main()
{
  float a[2] = { 1., 2. };
  struct X x = foo(a);
  if (__real x.val != 1.
      || __imag x.val != 2.)
    abort ();
  return 0;
}


-- 


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


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

* [Bug target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (20 preceding siblings ...)
  2009-04-08  8:40 ` rguenth at gcc dot gnu dot org
@ 2009-04-08  9:11 ` paolo dot carlini at oracle dot com
  2009-04-08 23:42 ` [Bug target/39678] C++ empty struct is passed incorrectly hjl dot tools at gmail dot com
                   ` (12 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-08  9:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from paolo dot carlini at oracle dot com  2009-04-08 09:11 -------
Excellent, thanks.


-- 


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


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

* [Bug target/39678] C++ empty struct is passed incorrectly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (21 preceding siblings ...)
  2009-04-08  9:11 ` paolo dot carlini at oracle dot com
@ 2009-04-08 23:42 ` hjl dot tools at gmail dot com
  2009-04-09  1:16 ` [Bug target/39678] complex type isn't passed correctly hjl dot tools at gmail dot com
                   ` (11 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-08 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from hjl dot tools at gmail dot com  2009-04-08 23:41 -------
This looks like an ABI issue:

[hjl@gnu-6 pr39678]$ cat pr39678.c
#include <stdio.h>

struct Y {};
struct X {
  struct Y y;
  __complex__ float val;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  __real x.val = p[0];
  __imag x.val = p[1];
  return x;
}
#ifdef __cplusplus
extern "C"
#endif
void abort (void);
float a[2] = { 3., -2. };
int main()
{
  struct X x = foo(a);
  printf ("X: %d\n", (int) sizeof (struct X));
  printf ("Y: %d\n", (int) sizeof (struct Y));
  if (__real x.val != 3.)
    abort ();
  if (__imag x.val != -2.)
    abort ();
  return 0;
}
[hjl@gnu-6 pr39678]$ gcc pr39678.c
[hjl@gnu-6 pr39678]$ ./a.out 
X: 8
Y: 0
[hjl@gnu-6 pr39678]$ g++ pr39678.c
[hjl@gnu-6 pr39678]$ ./a.out 
X: 12
Y: 1
Aborted
[hjl@gnu-6 pr39678]$ 

"struct Y {};" isn't handled properly in C++.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jh at suse dot cz
            Summary|std::transform is incorrect |C++ empty struct is passed
                   |with std::multiples and     |incorrectly
                   |bind2nd for complex<float>  |


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (22 preceding siblings ...)
  2009-04-08 23:42 ` [Bug target/39678] C++ empty struct is passed incorrectly hjl dot tools at gmail dot com
@ 2009-04-09  1:16 ` hjl dot tools at gmail dot com
  2009-04-09  1:17 ` hjl dot tools at gmail dot com
                   ` (10 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09  1:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from hjl dot tools at gmail dot com  2009-04-09 01:15 -------
Here is a testcase in C:

[hjl@gnu-6 pr39678]$ cat pr39678-2.c
struct Y { char c; };
struct X {
  struct Y y;
  __complex__ float val;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  __real x.val = p[0];
  __imag x.val = p[1];
  return x;
}
void abort (void);
float a[2] = { 3., -2. };
int main()
{
  struct X x = foo(a);
  if (__real x.val != 3.)
    abort ();
  if (__imag x.val != -2.)
    abort ();
  return 0;
}
[hjl@gnu-6 pr39678]$ gcc pr39678-2.c  
[hjl@gnu-6 pr39678]$ ./a.out
Aborted
[hjl@gnu-6 pr39678]$ 


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|C++ empty struct is passed  |complex type isn't passed
                   |incorrectly                 |correctly


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (23 preceding siblings ...)
  2009-04-09  1:16 ` [Bug target/39678] complex type isn't passed correctly hjl dot tools at gmail dot com
@ 2009-04-09  1:17 ` hjl dot tools at gmail dot com
  2009-04-09  1:18 ` hjl dot tools at gmail dot com
                   ` (9 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09  1:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from hjl dot tools at gmail dot com  2009-04-09 01:16 -------
Created an attachment (id=17608)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17608&action=view)
A patch

This patch seems to work.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17603|0                           |1
        is obsolete|                            |
  Attachment #17606|0                           |1
        is obsolete|                            |


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (24 preceding siblings ...)
  2009-04-09  1:17 ` hjl dot tools at gmail dot com
@ 2009-04-09  1:18 ` hjl dot tools at gmail dot com
  2009-04-09  4:43 ` hjl dot tools at gmail dot com
                   ` (8 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09  1:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from hjl dot tools at gmail dot com  2009-04-09 01:18 -------
Created an attachment (id=17609)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17609&action=view)
A smaller patch


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17608|0                           |1
        is obsolete|                            |


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (25 preceding siblings ...)
  2009-04-09  1:18 ` hjl dot tools at gmail dot com
@ 2009-04-09  4:43 ` hjl dot tools at gmail dot com
  2009-04-09  7:58 ` rguenther at suse dot de
                   ` (7 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09  4:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from hjl dot tools at gmail dot com  2009-04-09 04:43 -------
I think this one is better:

Index: i386.c
===================================================================
--- i386.c      (revision 145733)
+++ i386.c      (working copy)
@@ -5273,7 +5273,13 @@ classify_argument (enum machine_mode mod
       return 2;
     case SCmode:
       classes[0] = X86_64_SSE_CLASS;
-      return 1;
+      if (!(bit_offset % 64))
+       return 1;
+      else
+       {
+         classes[1] = X86_64_SSESF_CLASS;
+         return 2;
+       }
     case DCmode:
       classes[0] = X86_64_SSEDF_CLASS;
       classes[1] = X86_64_SSEDF_CLASS;


-- 


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (26 preceding siblings ...)
  2009-04-09  4:43 ` hjl dot tools at gmail dot com
@ 2009-04-09  7:58 ` rguenther at suse dot de
  2009-04-09 14:18 ` hjl dot tools at gmail dot com
                   ` (6 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenther at suse dot de @ 2009-04-09  7:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from rguenther at suse dot de  2009-04-09 07:58 -------
Subject: Re:  C++ empty struct is passed incorrectly

On Wed, 8 Apr 2009, hjl dot tools at gmail dot com wrote:

> ------- Comment #23 from hjl dot tools at gmail dot com  2009-04-08 23:41 -------
> This looks like an ABI issue:
> 
> [hjl@gnu-6 pr39678]$ cat pr39678.c
> #include <stdio.h>
> 
> struct Y {};
> struct X {
>   struct Y y;
>   __complex__ float val;
> };
> 
> struct X __attribute__((noinline))
> foo (float *p)
> {
>   struct X x;
>   __real x.val = p[0];
>   __imag x.val = p[1];
>   return x;
> }
> #ifdef __cplusplus
> extern "C"
> #endif
> void abort (void);
> float a[2] = { 3., -2. };
> int main()
> {
>   struct X x = foo(a);
>   printf ("X: %d\n", (int) sizeof (struct X));
>   printf ("Y: %d\n", (int) sizeof (struct Y));
>   if (__real x.val != 3.)
>     abort ();
>   if (__imag x.val != -2.)
>     abort ();
>   return 0;
> }
> [hjl@gnu-6 pr39678]$ gcc pr39678.c
> [hjl@gnu-6 pr39678]$ ./a.out 
> X: 8
> Y: 0
> [hjl@gnu-6 pr39678]$ g++ pr39678.c
> [hjl@gnu-6 pr39678]$ ./a.out 
> X: 12
> Y: 1
> Aborted
> [hjl@gnu-6 pr39678]$ 
> 
> "struct Y {};" isn't handled properly in C++.

sizeof(Y) is 1 according to the C++ standard.

Richard.


-- 


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (27 preceding siblings ...)
  2009-04-09  7:58 ` rguenther at suse dot de
@ 2009-04-09 14:18 ` hjl dot tools at gmail dot com
  2009-04-09 15:09 ` diepen at astron dot nl
                   ` (5 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09 14:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #29 from hjl dot tools at gmail dot com  2009-04-09 14:17 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2009-04/msg00700.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2009-
                   |                            |04/msg00700.html


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (28 preceding siblings ...)
  2009-04-09 14:18 ` hjl dot tools at gmail dot com
@ 2009-04-09 15:09 ` diepen at astron dot nl
  2009-04-09 15:36 ` hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: diepen at astron dot nl @ 2009-04-09 15:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #30 from diepen at astron dot nl  2009-04-09 15:08 -------
I'm glad that the time I invested in writing the rather extensive test program
for the casacore ArrayMath pays off, although I had not expected to find this
problem.
Luckily it was not too hard to write a workaround in my code.

Thanks to you all for jumping so quickly on this problem and solving it.


-- 


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (29 preceding siblings ...)
  2009-04-09 15:09 ` diepen at astron dot nl
@ 2009-04-09 15:36 ` hjl dot tools at gmail dot com
  2009-04-09 15:46 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-04-09 15:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (30 preceding siblings ...)
  2009-04-09 15:36 ` hjl dot tools at gmail dot com
@ 2009-04-09 15:46 ` rguenth at gcc dot gnu dot org
  2009-04-09 22:59 ` hjl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-09 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #31 from rguenth at gcc dot gnu dot org  2009-04-09 15:46 -------
Non-regressions should not have a target milestone until they are fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.0                       |---


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (31 preceding siblings ...)
  2009-04-09 15:46 ` rguenth at gcc dot gnu dot org
@ 2009-04-09 22:59 ` hjl at gcc dot gnu dot org
  2009-04-14 20:28 ` hjl at gcc dot gnu dot org
  2009-04-28 23:44 ` pinskia at gcc dot gnu dot org
  34 siblings, 0 replies; 36+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-04-09 22:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #32 from hjl at gcc dot gnu dot org  2009-04-09 22:59 -------
Subject: Bug 39678

Author: hjl
Date: Thu Apr  9 22:58:51 2009
New Revision: 145865

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145865
Log:
gcc/

2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/39678
        * config/i386/i386.c (classify_argument): Handle SCmode with
        (bit_offset % 64) != 0.

gcc/testsuite/

2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/39678
        * g++.dg/torture/pr39678.C: New.
        * gcc.dg/compat/struct-complex-2.h: Likewise.
        * gcc.dg/compat/struct-complex-2_main.c: Likewise.
        * gcc.dg/compat/struct-complex-2_x.c: Likewise.
        * gcc.dg/compat/struct-complex-2_y.c: Likewise.
        * gcc.dg/torture/pr39678.c: Likewise.
        * gcc.target/i386/pr39678.c: Likewise.

        * gcc.dg/compat/struct-complex-1_x.c: Add -Wno-psabi.
        * gcc.dg/compat/struct-complex-1_y.c: Likewise.

        * gcc.target/x86_64/abi/test_passing_structs.c: Include
        <complex.h>.  Add tests for structure with complex float.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr39678.C
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2.h
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_main.c
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_x.c
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_y.c
    trunk/gcc/testsuite/gcc.dg/torture/pr39678.c
    trunk/gcc/testsuite/gcc.target/i386/pr39678.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c
    trunk/gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c
    trunk/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c


-- 


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (32 preceding siblings ...)
  2009-04-09 22:59 ` hjl at gcc dot gnu dot org
@ 2009-04-14 20:28 ` hjl at gcc dot gnu dot org
  2009-04-28 23:44 ` pinskia at gcc dot gnu dot org
  34 siblings, 0 replies; 36+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-04-14 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #33 from hjl at gcc dot gnu dot org  2009-04-14 20:27 -------
Subject: Bug 39678

Author: hjl
Date: Tue Apr 14 20:27:30 2009
New Revision: 146061

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146061
Log:
gcc/

2009-04-14  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/39678
        * config/i386/i386.c (classify_argument): Handle SCmode with
        (bit_offset % 64) != 0.

gcc/testsuite/

2009-04-14  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/39678
        * g++.dg/torture/pr39678.C: New.
        * gcc.dg/compat/struct-complex-2.h: Likewise.
        * gcc.dg/compat/struct-complex-2_main.c: Likewise.
        * gcc.dg/compat/struct-complex-2_x.c: Likewise.
        * gcc.dg/compat/struct-complex-2_y.c: Likewise.
        * gcc.dg/torture/pr39678.c: Likewise.
        * gcc.target/i386/pr39678.c: Likewise.

        * gcc.dg/compat/struct-complex-1_x.c: Add -Wno-psabi.
        * gcc.dg/compat/struct-complex-1_y.c: Likewise.

        * gcc.target/x86_64/abi/test_passing_structs.c: Include
        <complex.h>.  Add tests for structure with complex float.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr39678.C
      - copied unchanged from r146060,
trunk/gcc/testsuite/g++.dg/torture/pr39678.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-2.h
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2.h
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-2_main.c
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_main.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-2_x.c
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_x.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-2_y.c
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.dg/compat/struct-complex-2_y.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr39678.c
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.dg/torture/pr39678.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr39678.c
      - copied unchanged from r146060,
trunk/gcc/testsuite/gcc.target/i386/pr39678.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/i386/i386.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c
   
branches/gcc-4_4-branch/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c


-- 


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


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

* [Bug target/39678] complex type isn't passed correctly
  2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
                   ` (33 preceding siblings ...)
  2009-04-14 20:28 ` hjl at gcc dot gnu dot org
@ 2009-04-28 23:44 ` pinskia at gcc dot gnu dot org
  34 siblings, 0 replies; 36+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-28 23:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #34 from pinskia at gcc dot gnu dot org  2009-04-28 23:43 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

end of thread, other threads:[~2009-04-28 23:44 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07 13:50 [Bug c++/39678] New: std::transform is incorrect with std::multiples and bind2nd for complex<float> diepen at astron dot nl
2009-04-07 13:54 ` [Bug c++/39678] " paolo dot carlini at oracle dot com
2009-04-07 14:03 ` diepen at astron dot nl
2009-04-07 14:18 ` paolo dot carlini at oracle dot com
2009-04-07 14:24 ` paolo dot carlini at oracle dot com
2009-04-07 14:51 ` [Bug target/39678] " rguenth at gcc dot gnu dot org
2009-04-07 15:04 ` paolo dot carlini at oracle dot com
2009-04-07 15:29 ` rguenth at gcc dot gnu dot org
2009-04-07 15:33 ` paolo dot carlini at oracle dot com
2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
2009-04-07 15:45 ` rguenth at gcc dot gnu dot org
2009-04-07 15:47 ` rguenth at gcc dot gnu dot org
2009-04-07 15:48 ` paolo dot carlini at oracle dot com
2009-04-07 15:57 ` rguenth at gcc dot gnu dot org
2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
2009-04-07 16:05 ` rguenth at gcc dot gnu dot org
2009-04-07 16:24 ` paolo dot carlini at oracle dot com
2009-04-07 16:45 ` paolo dot carlini at oracle dot com
2009-04-07 19:01 ` paolo dot carlini at oracle dot com
2009-04-07 20:47 ` paolo dot carlini at oracle dot com
2009-04-07 22:04 ` paolo dot carlini at oracle dot com
2009-04-08  8:40 ` rguenth at gcc dot gnu dot org
2009-04-08  9:11 ` paolo dot carlini at oracle dot com
2009-04-08 23:42 ` [Bug target/39678] C++ empty struct is passed incorrectly hjl dot tools at gmail dot com
2009-04-09  1:16 ` [Bug target/39678] complex type isn't passed correctly hjl dot tools at gmail dot com
2009-04-09  1:17 ` hjl dot tools at gmail dot com
2009-04-09  1:18 ` hjl dot tools at gmail dot com
2009-04-09  4:43 ` hjl dot tools at gmail dot com
2009-04-09  7:58 ` rguenther at suse dot de
2009-04-09 14:18 ` hjl dot tools at gmail dot com
2009-04-09 15:09 ` diepen at astron dot nl
2009-04-09 15:36 ` hjl dot tools at gmail dot com
2009-04-09 15:46 ` rguenth at gcc dot gnu dot org
2009-04-09 22:59 ` hjl at gcc dot gnu dot org
2009-04-14 20:28 ` hjl at gcc dot gnu dot org
2009-04-28 23:44 ` pinskia at gcc dot gnu dot org

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).