diff mbox series

Add test-case (PR ipa/84805).

Message ID 50ffdafc-a226-e928-a5da-d7e1fef2252f@suse.cz
State New
Headers show
Series Add test-case (PR ipa/84805). | expand

Commit Message

Martin Liška March 14, 2018, 5:23 p.m. UTC
Hi.

This is a new test-case isolated from libreoffice.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
I'm going to install it.

Martin

gcc/testsuite/ChangeLog:

2018-03-14  Martin Liska  <mliska@suse.cz>

	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.
---
 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 ++++++++++++++++++++++++++++++
 3 files changed, 297 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

Comments

Eric Botcazou March 14, 2018, 8:12 p.m. UTC | #1
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Please make sure to test it on more platforms (see PR ipa/83983 for details).
Christophe Lyon March 15, 2018, 8:26 a.m. UTC | #2
On 14 March 2018 at 21:12, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Please make sure to test it on more platforms (see PR ipa/83983 for details).
>

Hi,

These new tests do not work well on arm-none-eabi and aarch64-none-elf.
(as opposed to arm*linux* and aarch64*linux*)

On arm-none-eabi, I see:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/bin/ld:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc3/gcc/testsuite/g++1/../../crtbegin.o:
relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used
when making a shared object; recompile with -fPIC
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc3/gcc/testsuite/g++1/../../crtbegin.o:
error adding symbols: Bad value
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 106)
FAIL: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 142)
FAIL: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 147)
FAIL: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_1.C line 6)
FAIL: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_2.C line 18)
FAIL: g++.dg/lto/pr84805 cp_lto_pr84805_0.o-cp_lto_pr84805_2.o link,
-O2 -fPIC -shared -flto

On aarch64-none-elf, I see:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/aarch64-none-elf/bin/ld:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/lib/gcc/aarch64-none-elf/8.0.1/../../../../aarch64-none-elf/lib/librdimon.a(rdimon-syscalls.o):
relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol
`_impure_ptr' can not be used when making a shared object; recompile
with -fPIC
PASS: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 106)
PASS: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 142)
PASS: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_0.C line 147)
PASS: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_1.C line 6)
PASS: g++.dg/lto/pr84805  (test for LTO warnings, pr84805_2.C line 18)
FAIL: g++.dg/lto/pr84805 cp_lto_pr84805_0.o-cp_lto_pr84805_2.o link,
-O2 -fPIC -shared -flto

Christophe


> --
> Eric Botcazou
Martin Liška March 15, 2018, 8:59 a.m. UTC | #3
On 03/14/2018 09:12 PM, Eric Botcazou wrote:
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Please make sure to test it on more platforms (see PR ipa/83983 for details).
> 

Sorry for the breakage. Actually I did testing on x86_64 and ppcl64 machines.

Martin
Eric Botcazou March 15, 2018, 12:15 p.m. UTC | #4
> Sorry for the breakage. Actually I did testing on x86_64 and ppcl64
> machines.

There is no breakage, just an issue with the ordering of warnings which may 
vary across platforms.
Jeff Law March 20, 2018, 9:01 p.m. UTC | #5
On 03/14/2018 11:23 AM, Martin Liška wrote:
> Hi.
> 
> This is a new test-case isolated from libreoffice.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> I'm going to install it.
> 
> Martin
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-03-14  Martin Liska  <mliska@suse.cz>
> 
> 	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.
OK if you test on other targets and they're passing -- per Eric B's warning.

jeff
diff mbox series

Patch

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() {}