gcc-5.2.1 miscompiles moved-from deque with private allocator
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
Unknown
|
Unknown
|
|||
gcc-5 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This is upstream bug https:/
The following program:
#include <stdio.h>
#include <utility>
#include <deque>
#include <memory>
template<typename T>
struct my_allocator: public std::allocator<T>
{
typedef size_t size_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef std::false_type is_always_equal;
struct rebind
{
};
pointer allocate(size_type n, const void *hint = nullptr)
{
}
void deallocate(pointer p, size_type n)
{
}
size_type max_size() const
{
}
};
int main(int argc, char * argv[])
{
a = std::deque<int, my_allocator<
return 0;
}
incorrectly corrupts deque state and crashes:
$ g++-5 --std=c++11 a.cpp
$ ./a.out
empty 1 size 0
empty 0 size 1
empty 1 size -128
Segmentation fault (core dumped)
This is with:
$ g++-5 --version
g++-5 (Ubuntu 5.2.1-18ubuntu1) 5.2.1 20150922
If at all possible it would be great to get the upstream fix into Ubuntu 15.10 before the final release. The upstream patch is very small (one line plus test case and changelog).
ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: gcc-5 5.2.1-18ubuntu1
ProcVersionSign
Uname: Linux 4.2.0-10-generic x86_64
ApportVersion: 2.18.1-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Sep 24 16:53:12 2015
InstallationDate: Installed on 2014-01-11 (621 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140109)
SourcePackage: gcc-5
UpgradeStatus: Upgraded to wily on 2015-09-18 (6 days ago)
This bug was fixed in the package gcc-5 - 5.2.1-19ubuntu1
---------------
gcc-5 (5.2.1-19ubuntu1) wily; urgency=medium
* Configure --with-arch=zEC12 on s390x Ubuntu.
gcc-5 (5.2.1-19) unstable; urgency=medium
* Update to SVN 20150930 (r228302, 5.2.1) from the gcc-5-branch.
- Fix PR ipa/66424. Closes: #800318.
[ Matthias Klose ] svn,prj} -dev: For cross builds, move adainclude and adalib files directly- on-multiarch- support warnings.
* Update the Linaro support to the 5-2015.09 snapshot.
* Fix PR libstdc++/67707, taken from the trunk. LP: #1499564.
* Ship libgcj.spec in gcj-5 instead of gcj-5-jdk. Closes: #800010.
* gcj-5: Suggest gcj-5-jdk.
* Fix base dependency for ada cross library packages.
* Add ${shlibs:Depends} for libgnatvsn and libgnatprj.
* Link lrealpath.o into libgnatprj. Closes: #800045.
* libgnat{
into the gcc libdir.
* Default to POWER8 on ppc64el.
* armv8: Fix slt lda missing conditional code (taken from the trunk).
* Fix lintian pre-depends-
[ Aurelien Jarno ] n/67736 when building for
* Apply proposed patch for PR rtl-optimizatio
mips64 or mips64el. Closes: #800321.
-- Matthias Klose <email address hidden> Wed, 30 Sep 2015 22:55:14 +0200