public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59374] New: -ftree-slp-vectorize breaks unique_ptr's move constructor
@ 2013-12-03  0:02 niteria at gmail dot com
  2013-12-03  9:23 ` [Bug tree-optimization/59374] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: niteria at gmail dot com @ 2013-12-03  0:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59374
           Summary: -ftree-slp-vectorize breaks unique_ptr's move
                    constructor
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: niteria at gmail dot com

Created attachment 31358
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31358&action=edit
result of -save-temps

Test file (SmallCore.cpp):

#include <memory>
#include <iostream>

using namespace std;

class Foo {};
class Bar : public Foo {};

struct StlAllocator {
  StlAllocator() : alloc_(nullptr) {}
  explicit StlAllocator(void* p) : alloc_(p) {}
  void* alloc_;
};

struct BarDelete : public StlAllocator {
  void operator()(void*) const {}
};

struct FooDelete : public StlAllocator {
  FooDelete() = default;
  /* implicit */ FooDelete(const BarDelete& other) : StlAllocator(other.alloc_)
    {}
  void operator()(void*) const {}
};

unique_ptr<Bar, BarDelete> myalloc() {
  return unique_ptr<Bar, BarDelete>(new Bar);
}

void fun(const unique_ptr<Foo, FooDelete>& foo) {
  cout << "fun " << foo.get() << endl;
}

int main(int, char **) {
  std::unique_ptr<Foo, FooDelete> foo;
  std::unique_ptr<Bar, BarDelete> bar = myalloc();
  foo = std::move(bar);

  auto p = foo.get();
  cout << "p " << p << endl;
  if (p != foo.get()) {
    cout << "wtf" << endl;
    abort();
  }

  fun(foo);
  return 0;
}

Compiled with: g++ -std=c++11 -O -ftree-slp-vectorize SmallCore.cpp

Produces: 
$ ./a.out
p 0x602010
wtf
Aborted

Expected result (up to pointer address):
$ ./a.out
p 0x602010
fun 0x602010

Gcc versions:
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/data/users/bnitka/prefix/ --with-ppl
--with-cloog --enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-languages=c,c++
--disable-gnu-unique-object --enable-linker-build-id --with-gnu-as
--with-gnu-ld --disable-multilib --enable-libstdcxx-time
Thread model: posix
gcc version 4.8.1 (GCC)

Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/data/users/bnitka/prefix/ --with-ppl
--with-cloog --enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-languages=c,c++
--disable-gnu-unique-object --enable-linker-build-id --with-gnu-as
--with-gnu-ld --disable-multilib --enable-libstdcxx-time
Thread model: posix
gcc version 4.9.0 20131202 (experimental) (GCC)

Works on:
gcc-4.7.1


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

end of thread, other threads:[~2015-06-23  8:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-03  0:02 [Bug tree-optimization/59374] New: -ftree-slp-vectorize breaks unique_ptr's move constructor niteria at gmail dot com
2013-12-03  9:23 ` [Bug tree-optimization/59374] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-12-03 11:40 ` rguenth at gcc dot gnu.org
2013-12-03 11:47 ` rguenth at gcc dot gnu.org
2013-12-03 13:02 ` rguenth at gcc dot gnu.org
2013-12-05  9:12 ` rguenth at gcc dot gnu.org
2013-12-05  9:24 ` [Bug tree-optimization/59374] [4.8 " rguenth at gcc dot gnu.org
2014-01-10  9:34 ` [Bug tree-optimization/59374] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2014-01-10 10:53 ` rguenth at gcc dot gnu.org
2014-01-10 13:08 ` [Bug tree-optimization/59374] [4.7/4.8 " rguenth at gcc dot gnu.org
2014-01-10 13:08 ` [Bug tree-optimization/59374] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2014-05-22  9:06 ` [Bug tree-optimization/59374] [4.7/4.8 " rguenth at gcc dot gnu.org
2014-09-17 16:37 ` [Bug tree-optimization/59374] [4.8 " paolo.carlini at oracle dot com
2014-12-10 12:51 ` rguenth at gcc dot gnu.org
2014-12-19 13:34 ` jakub at gcc dot gnu.org
2015-06-23  8:47 ` rguenth at gcc dot gnu.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).