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 target/39678] std::transform is incorrect with std::multiples and bind2nd for complex<float>



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


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