From 5677683f0fe457cb5317f201be1cec5cba4c3056 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 14 Mar 2018 18:26:38 +0100 Subject: [PATCH] Add test-case (PR ipa/84805). 2018-03-14 Martin Liska PR ipa/8480 * g++.dg/lto/pr84805_0.C: New test. * g++.dg/lto/pr84805_1.C: New test. * g++.dg/lto/pr84805_2.C: New test. From-SVN: r258529 --- gcc/testsuite/ChangeLog | 7 ++ gcc/testsuite/g++.dg/lto/pr84805_0.C | 151 +++++++++++++++++++++++++++ gcc/testsuite/g++.dg/lto/pr84805_1.C | 15 +++ gcc/testsuite/g++.dg/lto/pr84805_2.C | 131 +++++++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lto/pr84805_0.C create mode 100644 gcc/testsuite/g++.dg/lto/pr84805_1.C create mode 100644 gcc/testsuite/g++.dg/lto/pr84805_2.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14b8e99a04f..7217468eb73 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-03-14 Martin Liska + + PR ipa/8480 + * g++.dg/lto/pr84805_0.C: New test. + * g++.dg/lto/pr84805_1.C: New test. + * g++.dg/lto/pr84805_2.C: New test. + 2018-03-14 David Malcolm PR c/84852 diff --git a/gcc/testsuite/g++.dg/lto/pr84805_0.C b/gcc/testsuite/g++.dg/lto/pr84805_0.C new file mode 100644 index 00000000000..c34c6340201 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr84805_0.C @@ -0,0 +1,151 @@ +// { dg-lto-do link } +// { dg-lto-options {{-O2 -fPIC -shared -flto}} } + +template < typename _Tp, _Tp __v > struct integral_constant { + static constexpr _Tp value = __v; +}; +typedef integral_constant< bool, false > false_type; +struct __is_void_helper : false_type {}; +struct is_void : __is_void_helper {}; +template < typename > struct is_array : false_type {}; +namespace __gnu_cxx { +enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; +const _Lock_policy __default_lock_policy = _S_atomic; +} namespace std { +using __gnu_cxx::_Lock_policy; +using __gnu_cxx::__default_lock_policy; +template < _Lock_policy = __default_lock_policy > class _Sp_counted_base; +template < typename, _Lock_policy = __default_lock_policy > class __shared_ptr; +template < _Lock_policy > class __shared_count { _Sp_counted_base<> *_M_pi; }; +template < typename _Tp, _Lock_policy, bool = is_array< _Tp >::value, + bool = is_void::value > +class __shared_ptr_access {}; +template < typename _Tp, _Lock_policy _Lp > +class __shared_ptr : __shared_ptr_access< _Tp, _Lp > { + using element_type = _Tp; + element_type *_M_ptr; + __shared_count< _Lp > _M_refcount; +}; +template < typename _Tp > class shared_ptr : __shared_ptr< _Tp > {}; +} typedef struct _rtl_String rtl_String; +typedef struct _rtl_uString rtl_uString; +namespace rtl { +class OString { + rtl_String *pData; +}; +} using rtl::OString; +namespace rtl { +class OUString { + rtl_uString *pData; +}; +} using rtl::OUString; +namespace tools { +template < typename T > class SvRef { +T *pObj; +}; +} class SvRefBase { + unsigned nRefCount : 31; + unsigned bNoDelete : 1; + +protected: + virtual ~SvRefBase(); +}; +class ErrCode { + unsigned m_value; +}; +class SvStream; +class SfxMedium; +struct strong_int { + unsigned short m_value; +}; +typedef strong_int LanguageType; +class SotObject : virtual SvRefBase { + unsigned short nOwnerLockCount; + bool bInClose; +}; +class BaseStorage; +class SotStorage : virtual SotObject { + BaseStorage *m_pOwnStg; + SvStream *m_pStorStm; + ErrCode m_nError; + OUString m_aName; + bool m_bIsRoot; + bool m_bDelStm; + OString m_aKey; + int m_nVersion; +}; +class ScDocument; +class ScAddress { + int nRow; + short nCol; + short nTab; +}; +enum XclBiff {}; +enum XclOutput {}; +enum BiffTyp {}; +class SharedFormulaBuffer; +class ExtNameBuff; +class ExtSheetBuffer; +class ExcelToSc; +class XclImpColRowSettings; +struct RootData { + BiffTyp eDateiTyp; + ExtSheetBuffer *pExtSheetBuff; + SharedFormulaBuffer *pShrfmlaBuff; + ExtNameBuff *pExtNameBuff; + ExcelToSc *pFmlaConverter; + XclImpColRowSettings *pColRowBuff; +}; +class ScEditEngineDefaulter; +class ScHeaderEditEngine; +class EditEngine; +class ScExtDocOptions; +class XclFontPropSetHelper; +class XclChPropSetHelper; +class XclTracer; +struct XclRootData { // { dg-lto-warning "8: type 'struct XclRootData' violates the C\\+\\+ One Definition Rule" } + typedef std::shared_ptr< ScEditEngineDefaulter > ScEEDefaulterRef; + typedef std::shared_ptr< ScHeaderEditEngine > ScHeaderEERef; + typedef std::shared_ptr< EditEngine > EditEngineRef; + typedef std::shared_ptr< XclFontPropSetHelper > XclFontPropSetHlpRef; + typedef std::shared_ptr< XclChPropSetHelper > XclChPropSetHlpRef; + typedef std::shared_ptr< ScExtDocOptions > ScExtDocOptRef; + typedef std::shared_ptr< XclTracer > XclTracerRef; + typedef std::shared_ptr< RootData > RootDataRef; + XclBiff meBiff; + XclOutput meOutput; + SfxMedium &mrMedium; + tools::SvRef< SotStorage > mxRootStrg; + ScDocument &mrDoc; + OUString maDocUrl; + OUString maBasePath; + OUString maUserName; + OUString maDefPassword; + unsigned short meTextEnc; + LanguageType meSysLang; + LanguageType meDocLang; + LanguageType meUILang; + short mnDefApiScript; + ScAddress maScMaxPos; + ScAddress maXclMaxPos; + ScAddress maMaxPos; + ScEEDefaulterRef mxEditEngine; + ScHeaderEERef mxHFEditEngine; + EditEngineRef mxDrawEditEng; + XclFontPropSetHlpRef mxFontPropSetHlp; + XclChPropSetHlpRef mxChPropSetHlp; + ScExtDocOptRef mxExtDocOpt; + XclTracerRef mxTracer; + RootDataRef mxRD; + virtual ~XclRootData(); +}; +class XclRoot { // { dg-lto-warning "7: type 'struct XclRoot' violates the C\\+\\+ One Definition Rule" } +public: + virtual ~XclRoot(); + XclRootData &mrData; +}; +class XclImpRoot : XclRoot {}; // { dg-lto-warning "7: type 'struct XclImpRoot' violates the C\\+\\+ One Definition Rule" } +class XclImpColRowSettings : XclImpRoot {}; +void lcl_ExportExcelBiff() { +XclRootData aExpData(); +} diff --git a/gcc/testsuite/g++.dg/lto/pr84805_1.C b/gcc/testsuite/g++.dg/lto/pr84805_1.C new file mode 100644 index 00000000000..c59a37c5fc0 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr84805_1.C @@ -0,0 +1,15 @@ +class XclRoot { +public: + virtual ~XclRoot(); +}; +class XclImpRoot : XclRoot {}; +struct RootData { // { dg-lto-warning "8: type 'struct RootData' violates the C\\+\\+ One Definition Rule" } + XclImpRoot pIR; +}; +class ExcRoot { +RootData pExcRoot; +}; +class XclImpAutoFilterData : ExcRoot { + void SetExtractPos(const int &); +}; +void XclImpAutoFilterData::SetExtractPos(const int &) {} diff --git a/gcc/testsuite/g++.dg/lto/pr84805_2.C b/gcc/testsuite/g++.dg/lto/pr84805_2.C new file mode 100644 index 00000000000..a043dac6674 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr84805_2.C @@ -0,0 +1,131 @@ +template < typename a, a b > struct c { static constexpr a d = b; }; +typedef c< bool, false > e; +struct f : e {}; +struct t : f {}; +template < typename > struct g : e {}; +namespace __gnu_cxx { +enum _Lock_policy { h, i, j } const k = j; +} +namespace std { +using __gnu_cxx::_Lock_policy; +using __gnu_cxx::k; +template < _Lock_policy = k > class _Sp_counted_base; +template < typename, _Lock_policy = k > class __shared_ptr; +template < _Lock_policy > class __shared_count { _Sp_counted_base<> *_M_pi; }; +template < typename a, _Lock_policy, bool = g< a >::d, bool = t::d > +class __shared_ptr_access {}; +template < typename a, _Lock_policy l > +class __shared_ptr : __shared_ptr_access< a, l > { // { dg-lto-warning "7: type 'struct __shared_ptr' violates the C\\+\\+ One Definition Rule" } + using m = a; + m *_M_ptr; + __shared_count< l > _M_refcount; +}; +template < typename a > class n : __shared_ptr< a > {}; +} namespace rtl { +class OString { + struct o *pData; +}; +} using rtl::OString; +namespace rtl { +class OUString { + struct p *pData; +}; +} using rtl::OUString; +struct q { + unsigned short m_value; +}; +namespace tools { +template < typename r > class SvRef { r *pObj; }; +} class SvRefBase { + unsigned nRefCount : 31; + unsigned bNoDelete : 1; + +protected: + virtual ~SvRefBase(); +}; +class SotObject : virtual SvRefBase { + unsigned short nOwnerLockCount; + bool bInClose; +}; +class ErrCode { + unsigned m_value; +}; +class SvStream; +class BaseStorage; +class SotStorage : virtual SotObject { + BaseStorage *m_pOwnStg; + SvStream *m_pStorStm; + ErrCode m_nError; + OUString m_aName; + bool m_bIsRoot; + bool m_bDelStm; + OString m_aKey; + int m_nVersion; +}; +class ScDocument; +class ScAddress { + int nRow; + short nCol; + short nTab; +}; +enum XclBiff {}; +enum XclOutput {}; +class SfxMedium; +class ScEditEngineDefaulter; +class ScHeaderEditEngine; +class EditEngine; +class ScExtDocOptions; +class XclFontPropSetHelper; +class XclChPropSetHelper; +class XclTracer; +struct RootData; +struct XclRootData { + XclBiff meBiff; + XclOutput meOutput; + SfxMedium &mrMedium; + tools::SvRef< SotStorage > mxRootStrg; + ScDocument &mrDoc; + OUString maDocUrl; + OUString maBasePath; + OUString maUserName; + OUString maDefPassword; + unsigned short meTextEnc; + q meSysLang; + q meDocLang; + q meUILang; + short mnDefApiScript; + ScAddress maScMaxPos; + ScAddress maXclMaxPos; + ScAddress maMaxPos; + std::n< ScEditEngineDefaulter > mxEditEngine; + std::n< ScHeaderEditEngine > mxHFEditEngine; + std::n< EditEngine > mxDrawEditEng; + std::n< XclFontPropSetHelper > mxFontPropSetHlp; + std::n< XclChPropSetHelper > mxChPropSetHlp; + std::n< ScExtDocOptions > mxExtDocOpt; + std::n< XclTracer > mxTracer; + std::n< RootData > mxRD; + virtual ~XclRootData(); +}; +class XclRoot { + virtual ~XclRoot(); + XclRootData &mrData; +}; +enum BiffTyp {}; +class SharedFormulaBuffer; +class ExtNameBuff; +class ExtSheetBuffer; +class ExcelToSc; +class XclImpColRowSettings; +class XclImpRoot; +struct RootData { + BiffTyp eDateiTyp; + ExtSheetBuffer *pExtSheetBuff; + SharedFormulaBuffer *pShrfmlaBuff; + ExtNameBuff *pExtNameBuff; + ExcelToSc *pFmlaConverter; + XclImpColRowSettings *pColRowBuff; + XclImpRoot *s; +}; +XclRootData::~XclRootData() {} +XclRoot::~XclRoot() {} -- 2.30.2