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

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