From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 604F5385840E; Sun, 20 Aug 2023 16:51:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 604F5385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692550280; bh=M2OYyIeijaJpD6Ah220A956jFmyO0s36TtNm22yx0kQ=; h=From:To:Subject:Date:From; b=gGphFrsHDspAbFkh4/TUPOrItfODC7Uu8PZC/PNctCZ/KV+rmVtPsN+Qzj0/k0OW/ ofRjs2FYWZV/3GaC0qnenJxW8ryQkQ30QpV0PLebSEn77FVzya0Uy9n5yviRYizcs1 MG2wswv0Qy4fqYPmxfyCy8zEpmzuc0EmdZL2mFDU= From: "fxcoudert at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin Date: Sun, 20 Aug 2023 16:51:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fxcoudert at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111083 Bug ID: 111083 Summary: Test failure of g++.dg/ipa/pr67056.C on darwin Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fxcoudert at gcc dot gnu.org Target Milestone: --- On darwin (both aarch64 and x86_64), we see the following test failure: FAIL: g++.dg/ipa/pr67056.C scan-ipa-dump cp "Speculative outer type:struct CompositeClass" This is the content generated for pr67056.C.082i.cp: ------ IPA constant propagation start: Determining dynamic type for call: CompositeClass::~CompositeClass (_3); Starting walk at: CompositeClass::~CompositeClass (_3); instance pointer: _3 Outer instance pointer: _3 offset: 0 (bits) vtbl reference:=20 Checking vtbl store: MEM[(struct CompositeClass *)_3]._vptr.CompositeClas= s =3D &MEM [(void *)&_ZTV14CompositeClass + 16B]; Recording type: struct CompositeClass at offset 0 Determined dynamic type. Determining dynamic type for call: operator delete (this_2(D)); Starting walk at: operator delete (this_2(D)); instance pointer: this_2(D) Outer instance pointer: this_2(D) offset: 0 (bits) vtbl reference:=20 No dynamic type change found. IPA structures before propagation: Jump functions: Jump functions of caller void operator delete(void*)/461: Jump functions of caller void* operator new(std::size_t)/460: Jump functions of caller int main(int, char**)/332: callsite int main(int, char**)/332 -> virtual CompositeClass::~CompositeClass()/320 :=20 param 0: UNKNOWN Aggregate passed by reference: offset: 0, type: int (*) () *, CONST: &MEM [(void *)&_ZTV14CompositeClass + 16B] Context: Outer type (dynamic):struct CompositeClass offset 0 value: 0x0, mask: 0xffffffffffffffff [irange] void * [1, +INF] callsite int main(int, char**)/332 -> void* operator new(std::size_t)/= 460 :=20 param 0: CONST: 16 value: 0x10, mask: 0x0 [irange] size_t [16, 16] Jump functions of caller bool boolFunc()/321: Jump functions of caller virtual CompositeClass::~CompositeClass()/320: callsite virtual CompositeClass::~CompositeClass()/320 -> void operator delete(void*)/461 :=20 param 0: PASS THROUGH: 0, op nop_expr Context: Outer type (dynamic):struct CompositeClass offset 0 value: 0x0, mask: 0xffffffffffffffff [irange] void * [1, +INF] Jump functions of caller virtual CompositeClass::~CompositeClass()/319: Jump functions of caller EmptyClass::EmptyClass()/313: Jump functions of caller EmptyClass::EmptyClass()/312: callsite EmptyClass::EmptyClass()/312 -> EmptyClass::EmptyClass()/313 = :=20 param 0: PASS THROUGH: 0, op nop_expr value: 0x0, mask: 0xffffffffffffffff [irange] void * [1, +INF] Propagating constants: Not considering int main(int, char**)/332 for cloning; no hot calls. Not considering virtual CompositeClass::~CompositeClass()/320 for cloning; = no hot calls. Not considering virtual CompositeClass::~CompositeClass()/319 for cloning; = no hot calls. Considering EmptyClass::EmptyClass()/313 for cloning. Not considering EmptyClass::EmptyClass()/312 for cloning; no hot calls. overall_size: 28 - context independent values, size: 9, time_benefit: 2.000000 - context independent values, size: 2, time_benefit: 1.000000 Decided to specialize for all known contexts, growth (to 30) deemed beneficial. IPA lattices after all propagation: Lattices: Node: int main(int, char**)/332: param [0]: BOTTOM ctxs: BOTTOM Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS BOTTOM param [1]: BOTTOM ctxs: BOTTOM Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS BOTTOM Node: bool boolFunc()/321: Node: virtual CompositeClass::~CompositeClass()/320: param [0]: BOTTOM ctxs: BOTTOM Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS BOTTOM Node: virtual CompositeClass::~CompositeClass()/319: param [0]: BOTTOM ctxs: BOTTOM Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS BOTTOM Node: EmptyClass::EmptyClass()/313: param [0]: VARIABLE ctxs: VARIABLE Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS VARIABLE Node: EmptyClass::EmptyClass()/312: param [0]: BOTTOM ctxs: BOTTOM Bits unusable (BOTTOM) [unsupported_range] VARYING AGGS BOTTOM IPA decision stage: - Creating a specialized node of EmptyClass::EmptyClass()/313 for all known contexts. IPA constant propagation end Reclaiming functions: Reclaiming variables: Clearing address taken flags: Symbol table: _ZN10EmptyClassC1Ev.constprop.0/468 (EmptyClass::EmptyClass()) Type: function definition analyzed Visibility: References:=20 Referring:=20 Clone of _ZN10EmptyClassC1Ev/313 Availability: local Function flags: count:1073741824 (estimated locally) local icf_merged Called by: _ZN10EmptyClassC2Ev/312 (1073741824 (estimated locally),1.00 p= er call)=20 Calls:=20 _ZTVN10__cxxabiv117__class_type_infoE/463 (int (* const __cxxabiv1::__class_type_info::_ZTVN10__cxxabiv117__class_type_infoE [])(..= .)) Type: variable Body removed by symtab_remove_unreachable_nodes Visibility: semantic_interposition external public visibility_specified virtual artificial References:=20 Referring: _ZTI14CompositeClass/406 (addr)=20 Availability: not_available Varpool flags: read-only _ZdlPv/461 (void operator delete(void*)) Type: function Visibility: semantic_interposition external public visibility_specified References:=20 Referring:=20 Availability: not_available Function flags: replaceable_operator_delete Called by: _ZN14CompositeClassD0Ev/320 (1073741824 (estimated locally),1.= 00 per call)=20 Calls:=20 _Znwm/460 (void* operator new(std::size_t)) Type: function Visibility: semantic_interposition external public visibility_specified References:=20 Referring:=20 Availability: not_available Function flags: decl_is_malloc replaceable_operator_new Called by: main/332 (1073741824 (estimated locally),1.00 per call) (can t= hrow external)=20 Calls:=20 _ZTS14CompositeClass/407 (const char _ZTS14CompositeClass [17]) Type: variable definition analyzed Visibility: externally_visible semantic_interposition public weak comdat comdat_group:_ZTS14CompositeClass one_only artificial References:=20 Referring: _ZTI14CompositeClass/406 (addr)=20 Availability: available Varpool flags: initialized read-only const-value-known _ZTI14CompositeClass/406 (const __class_type_info_pseudo_8 _ZTI14CompositeClass) Type: variable definition analyzed Visibility: externally_visible semantic_interposition public weak comdat comdat_group:_ZTI14CompositeClass one_only artificial References: _ZTVN10__cxxabiv117__class_type_infoE/463 (addr) _ZTS14CompositeClass/407 (addr)=20 Referring: _ZTV14CompositeClass/395 (addr)=20 Availability: available Varpool flags: initialized read-only const-value-known _ZTV14CompositeClass/395 (constexpr int (* CompositeClass::_ZTV14CompositeC= lass [4])(...)) Type: variable definition analyzed Visibility: externally_visible semantic_interposition public weak comdat comdat_group:_ZTV14CompositeClass one_only virtual artificial References: _ZTI14CompositeClass/406 (addr) _ZN14CompositeClassD1Ev/319 (addr) _ZN14CompositeClassD0Ev/320 (addr)=20 Referring: main/332 (addr)=20 Availability: available Varpool flags: initialized read-only const-value-known main/332 (int main(int, char**)) Type: function definition analyzed Visibility: externally_visible semantic_interposition public References: _ZTV14CompositeClass/395 (addr)=20 Referring:=20 Availability: available Function flags: count:1073741824 (estimated locally) body only_called_at_startup executed_once Called by:=20 Calls: _ZN14CompositeClassD0Ev/320 (1073741824 (estimated locally),1.00 p= er call) _Znwm/460 (1073741824 (estimated locally),1.00 per call) (can throw external)=20 _Z8boolFuncv/321 (bool boolFunc()) Type: function definition analyzed Visibility: externally_visible semantic_interposition public References:=20 Referring:=20 Availability: available Function flags: count:1073741824 (estimated locally) body Called by:=20 Calls:=20 _ZN14CompositeClassD0Ev/320 (virtual CompositeClass::~CompositeClass()) Type: function definition analyzed Visibility: externally_visible semantic_interposition public weak comdat comdat_group:_ZN14CompositeClassD0Ev one_only virtual Address is taken. References:=20 Referring: _ZTV14CompositeClass/395 (addr)=20 Availability: available Function flags: count:1073741824 (estimated locally) body Called by: main/332 (1073741824 (estimated locally),1.00 per call)=20 Calls: _ZdlPv/461 (1073741824 (estimated locally),1.00 per call)=20 _ZN14CompositeClassD1Ev/319 (virtual CompositeClass::~CompositeClass()) Type: function definition analyzed Visibility: externally_visible semantic_interposition public weak comdat comdat_group:_ZN14CompositeClassD1Ev one_only virtual Address is taken. References:=20 Referring: _ZTV14CompositeClass/395 (addr)=20 Availability: available Function flags: count:1073741824 (estimated locally) body Called by:=20 Calls:=20 _ZN10EmptyClassC1Ev/313 (EmptyClass::EmptyClass()) Type: function definition analyzed Visibility: externally_visible semantic_interposition public References:=20 Referring:=20 Availability: available Function flags: count:1073741824 (estimated locally) body icf_merged Called by:=20 Calls:=20 _ZN10EmptyClassC2Ev/312 (EmptyClass::EmptyClass()) Type: function definition analyzed Visibility: externally_visible semantic_interposition public References:=20 Referring:=20 Availability: available Function flags: count:1073741824 (estimated locally) body icf_merged Called by:=20 Calls: _ZN10EmptyClassC1Ev.constprop.0/468 (1073741824 (estimated locally),1.00 per call)=20 ;; Function CompositeClass::~CompositeClass (_ZN14CompositeClassD1Ev, funcdef_no=3D1542, decl_uid=3D28304, cgraph_uid=3D315, symbol_order=3D319) Modification phase of node virtual CompositeClass::~CompositeClass()/319 void CompositeClass::~CompositeClass (struct CompositeClass * const this) { [local count: 1073741824]: MEM[(struct __as_base &)this_2(D)] =3D{v} {CLOBBER}; return; } ;; Function CompositeClass::~CompositeClass (_ZN14CompositeClassD0Ev, funcdef_no=3D1543, decl_uid=3D28301, cgraph_uid=3D316, symbol_order=3D320) Modification phase of node virtual CompositeClass::~CompositeClass()/320 void CompositeClass::~CompositeClass (struct CompositeClass * const this) { [local count: 1073741824]: MEM[(struct __as_base &)this_2(D)] =3D{v} {CLOBBER}; operator delete (this_2(D)); return; } ;; Function EmptyClass::EmptyClass (_ZN10EmptyClassC2Ev, funcdef_no=3D1619, decl_uid=3D28257, cgraph_uid=3D308, symbol_order=3D312) Modification phase of node EmptyClass::EmptyClass()/312 void EmptyClass::EmptyClass (struct EmptyClass * const this) { [local count: 1073741824]: EmptyClass::EmptyClass (this_1(D)); [tail call] return; } ;; Function EmptyClass::EmptyClass (_ZN10EmptyClassC1Ev, funcdef_no=3D1536, decl_uid=3D28255, cgraph_uid=3D309, symbol_order=3D313) Modification phase of node EmptyClass::EmptyClass()/313 void EmptyClass::EmptyClass (struct EmptyClass * const this) { [local count: 1073741824]: return; } ;; Function boolFunc (_Z8boolFuncv, funcdef_no=3D1544, decl_uid=3D28334, cgraph_uid=3D317, symbol_order=3D321) Modification phase of node bool boolFunc()/321 bool boolFunc () { [local count: 1073741824]: return 1; } ;; Function main (main, funcdef_no=3D1555, decl_uid=3D31596, cgraph_uid=3D3= 28, symbol_order=3D332) (executed once) Modification phase of node int main(int, char**)/332 int main (int D.31594, char * * D.31595) { void * _3; [local count: 1073741824]: _3 =3D operator new (16); MEM[(struct __as_base &)_3] =3D{v} {CLOBBER}; MEM[(struct CompositeClass *)_3]._vptr.CompositeClass =3D &MEM [(void *)&_ZTV14CompositeClass + 16B]; CompositeClass::~CompositeClass (_3); return 0; } ------ I am wondering if it is because darwin has PIE forced on. The test also fai= ls on Linux if I force it with -fPIE. And if so, what is the right move=E2=80=A6 do we disable the test on darwin? diff --git a/gcc/testsuite/g++.dg/ipa/pr67056.C b/gcc/testsuite/g++.dg/ipa/pr67056.C index f47323b6e5d..350d9c1e840 100644 --- a/gcc/testsuite/g++.dg/ipa/pr67056.C +++ b/gcc/testsuite/g++.dg/ipa/pr67056.C @@ -36,4 +36,5 @@ int main(int, char **) { return 0; } -/* { dg-final { scan-ipa-dump "Speculative outer type:struct CompositeClas= s" "cp" } } */ +/* Darwin has PIE which defeats the test. */ +/* { dg-final { scan-ipa-dump "Speculative outer type:struct CompositeClas= s" "cp" { target { ! *-*-darwin* } } } } */=