[Bug 1577891] Re: Placement new destructor call optimized out

Launchpad Bug Tracker 1577891 at bugs.launchpad.net
Fri Oct 7 20:57:39 UTC 2016


Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: gcc-5 (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1577891

Title:
  Placement new destructor call optimized out

Status in gcc-5 package in Ubuntu:
  Confirmed

Bug description:
  We have a template class that we are using with placement new.  Code works fine in g++ (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4,
  however in g++ (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413, the destructor call is optimized out, even though we explicitly call it.  

  I have attached sample code (reduced down from our project) to show the issue.  If we add a NON-POD data type, everything works
  fine... this however is not an option for our project, as in our environment this is normally a packed class, though the example fails
  either way.

  
  This works:

  g++ -O0 -g -ggdb test.cpp -o test0 
  ./test0
  Before:000102030405060708090a0b0c0d0e0f10111213
  After :0000000000000000000000000000000000000000

  
  These do not:

  g++ -O1 -g -ggdb test.cpp -o test1
  g++ -O2 -g -ggdb test.cpp -o test2
  g++ -O3 -g -ggdb test.cpp -o test3
  ./test1
  Before:000102030405060708090a0b0c0d0e0f10111213
  After :000102030405060708090a0b0c0d0e0f10111213

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1577891/+subscriptions



More information about the foundations-bugs mailing list