[Bug 1577891] [NEW] Placement new destructor call optimized out
Jeff Curless
jeff.curless at cacheio.com
Tue May 3 18:25:06 UTC 2016
Public bug reported:
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
** Affects: gcc-5 (Ubuntu)
Importance: Undecided
Status: New
** Tags: xenial
** Attachment added: "test.cpp"
https://bugs.launchpad.net/bugs/1577891/+attachment/4654728/+files/test.cpp
--
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:
New
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