[Bug 1830506] [NEW] internal compiler error: in type_throw_all_p, at cp/except.c:1307

BaiYang 1830506 at bugs.launchpad.net
Sat May 25 23:49:24 UTC 2019


Public bug reported:

ubuntu 16.04, gcc 4.9.4 installed from: ppa:ubuntu-toolchain-r/test

When compile a simple test code:
/.../__test.cpp:186:3: internal compiler error: in type_throw_all_p, at cp/except.c:1307
   {}
   ^
Please submit a full bug report,

The full code is here:

/////////////////////////////////// begin of __test.cpp

#include <iostream>
#include <string>
#include <iomanip>
#include <limits.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <map>
#include <math.h>
#include <typeinfo>
#include <deque>
#include <new>
#include <bitset>
#include <typeinfo>
#include <memory>
using namespace std;

template<class _TT>
struct DeletorBase 
{
	typedef _TT		   value_type;
	typedef _TT*	   pointer;
	typedef const _TT* const_pointer;

	static constexpr bool ShouldThrow(void)
		{ return true; }
};


template<class _TT>
struct GuardedDeletor : DeletorBase<_TT>
{
	static constexpr bool ShouldThrow(void)
		{ return !std::is_nothrow_destructible<_TT>::value; }

	static inline void del(typename DeletorBase<_TT>::pointer p) 
	{
		if (ShouldThrow()) // Compiling time optimize
		{
			try
			{
				delete p;
			}
			catch (...)
			{
				operator delete(p);
				throw;
			}
		}
		else
		{
			delete p;
		}
	}
};


template< class _TT, class _DEL = GuardedDeletor< _TT > >
class CMyHandle
{
public:
	CMyHandle(_TT* ptr)
		: m_ptr(ptr)
		{}
	~CMyHandle() noexcept(!_DEL::ShouldThrow())
		{ _DEL::del(m_ptr); }

private:
	_TT* m_ptr;
};

class CMyClass
{
public:
	CMyClass(int n = 0)
		: m_thTest(new std::string)
		{}

	~CMyClass()
		{}

    typedef CMyHandle< std::string > THCLI;
    THCLI m_thTest;
};

int
main(int argc, char* argv[])
{
	return 0;
}

/////////////////////////////////// end of __test.cpp

The compile command line is:

g++-4.9 -Wall -fexceptions -fvisibility=hidden -march=athlon64 -O3 -w
-std=c++11 --param inline-unit-growth=200 -msse2 -I/root/develop-
lib/utilitis/include -I/root/develop-lib/crypto/include -I/root/develop-
lib/DM/sqlite_cpp/include -I/root/develop-lib/DM/report/include -I/root
/develop-lib/DM/odbc_cpp/include -I/root/develop-lib/DM/apidbc/include
-c /root/tmp/__tests/__test/__test.cpp -o linux_x64/obj/__test.o

** Affects: gcc-4.9 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "ccRzE0eX.out"
   https://bugs.launchpad.net/bugs/1830506/+attachment/5266561/+files/ccRzE0eX.out

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

Title:
   internal compiler error: in type_throw_all_p, at cp/except.c:1307

Status in gcc-4.9 package in Ubuntu:
  New

Bug description:
  ubuntu 16.04, gcc 4.9.4 installed from: ppa:ubuntu-toolchain-r/test

  When compile a simple test code:
  /.../__test.cpp:186:3: internal compiler error: in type_throw_all_p, at cp/except.c:1307
     {}
     ^
  Please submit a full bug report,

  The full code is here:

  /////////////////////////////////// begin of __test.cpp

  #include <iostream>
  #include <string>
  #include <iomanip>
  #include <limits.h>
  #include <time.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <stdarg.h>
  #include <map>
  #include <math.h>
  #include <typeinfo>
  #include <deque>
  #include <new>
  #include <bitset>
  #include <typeinfo>
  #include <memory>
  using namespace std;

  template<class _TT>
  struct DeletorBase 
  {
  	typedef _TT		   value_type;
  	typedef _TT*	   pointer;
  	typedef const _TT* const_pointer;

  	static constexpr bool ShouldThrow(void)
  		{ return true; }
  };

  
  template<class _TT>
  struct GuardedDeletor : DeletorBase<_TT>
  {
  	static constexpr bool ShouldThrow(void)
  		{ return !std::is_nothrow_destructible<_TT>::value; }

  	static inline void del(typename DeletorBase<_TT>::pointer p) 
  	{
  		if (ShouldThrow()) // Compiling time optimize
  		{
  			try
  			{
  				delete p;
  			}
  			catch (...)
  			{
  				operator delete(p);
  				throw;
  			}
  		}
  		else
  		{
  			delete p;
  		}
  	}
  };

  
  template< class _TT, class _DEL = GuardedDeletor< _TT > >
  class CMyHandle
  {
  public:
  	CMyHandle(_TT* ptr)
  		: m_ptr(ptr)
  		{}
  	~CMyHandle() noexcept(!_DEL::ShouldThrow())
  		{ _DEL::del(m_ptr); }

  private:
  	_TT* m_ptr;
  };

  class CMyClass
  {
  public:
  	CMyClass(int n = 0)
  		: m_thTest(new std::string)
  		{}

  	~CMyClass()
  		{}

      typedef CMyHandle< std::string > THCLI;
      THCLI m_thTest;
  };

  int
  main(int argc, char* argv[])
  {
  	return 0;
  }

  /////////////////////////////////// end of __test.cpp

  The compile command line is:

  g++-4.9 -Wall -fexceptions -fvisibility=hidden -march=athlon64 -O3 -w
  -std=c++11 --param inline-unit-growth=200 -msse2 -I/root/develop-
  lib/utilitis/include -I/root/develop-lib/crypto/include -I/root
  /develop-lib/DM/sqlite_cpp/include -I/root/develop-
  lib/DM/report/include -I/root/develop-lib/DM/odbc_cpp/include -I/root
  /develop-lib/DM/apidbc/include -c /root/tmp/__tests/__test/__test.cpp
  -o linux_x64/obj/__test.o

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



More information about the foundations-bugs mailing list