public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin
@ 2023-08-20 16:51 fxcoudert at gcc dot gnu.org
  2023-08-20 16:51 ` [Bug c++/111083] " fxcoudert at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-08-20 16:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111083

            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: 
  Checking vtbl store: MEM[(struct CompositeClass *)_3]._vptr.CompositeClass =
&MEM <int (*) ()[4]> [(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: 
  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 : 
       param 0: UNKNOWN
         Aggregate passed by reference:
           offset: 0, type: int (*) () *, CONST: &MEM <int (*) ()[4]> [(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
: 
       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 : 
       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 : 
       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: 
  Referring: 
  Clone of _ZN10EmptyClassC1Ev/313
  Availability: local
  Function flags: count:1073741824 (estimated locally) local icf_merged
  Called by: _ZN10EmptyClassC2Ev/312 (1073741824 (estimated locally),1.00 per
call) 
  Calls: 
_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: 
  Referring: _ZTI14CompositeClass/406 (addr) 
  Availability: not_available
  Varpool flags: read-only
_ZdlPv/461 (void operator delete(void*))
  Type: function
  Visibility: semantic_interposition external public visibility_specified
  References: 
  Referring: 
  Availability: not_available
  Function flags: replaceable_operator_delete
  Called by: _ZN14CompositeClassD0Ev/320 (1073741824 (estimated locally),1.00
per call) 
  Calls: 
_Znwm/460 (void* operator new(std::size_t))
  Type: function
  Visibility: semantic_interposition external public visibility_specified
  References: 
  Referring: 
  Availability: not_available
  Function flags: decl_is_malloc replaceable_operator_new
  Called by: main/332 (1073741824 (estimated locally),1.00 per call) (can throw
external) 
  Calls: 
_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: 
  Referring: _ZTI14CompositeClass/406 (addr) 
  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) 
  Referring: _ZTV14CompositeClass/395 (addr) 
  Availability: available
  Varpool flags: initialized read-only const-value-known
_ZTV14CompositeClass/395 (constexpr int (* CompositeClass::_ZTV14CompositeClass
[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) 
  Referring: main/332 (addr) 
  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) 
  Referring: 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body
only_called_at_startup executed_once
  Called by: 
  Calls: _ZN14CompositeClassD0Ev/320 (1073741824 (estimated locally),1.00 per
call) _Znwm/460 (1073741824 (estimated locally),1.00 per call) (can throw
external) 
_Z8boolFuncv/321 (bool boolFunc())
  Type: function definition analyzed
  Visibility: externally_visible semantic_interposition public
  References: 
  Referring: 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body
  Called by: 
  Calls: 
_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: 
  Referring: _ZTV14CompositeClass/395 (addr) 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body
  Called by: main/332 (1073741824 (estimated locally),1.00 per call) 
  Calls: _ZdlPv/461 (1073741824 (estimated locally),1.00 per call) 
_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: 
  Referring: _ZTV14CompositeClass/395 (addr) 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body
  Called by: 
  Calls: 
_ZN10EmptyClassC1Ev/313 (EmptyClass::EmptyClass())
  Type: function definition analyzed
  Visibility: externally_visible semantic_interposition public
  References: 
  Referring: 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body icf_merged
  Called by: 
  Calls: 
_ZN10EmptyClassC2Ev/312 (EmptyClass::EmptyClass())
  Type: function definition analyzed
  Visibility: externally_visible semantic_interposition public
  References: 
  Referring: 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body icf_merged
  Called by: 
  Calls: _ZN10EmptyClassC1Ev.constprop.0/468 (1073741824 (estimated
locally),1.00 per call) 

;; Function CompositeClass::~CompositeClass (_ZN14CompositeClassD1Ev,
funcdef_no=1542, decl_uid=28304, cgraph_uid=315, symbol_order=319)

Modification phase of node virtual CompositeClass::~CompositeClass()/319
void CompositeClass::~CompositeClass (struct CompositeClass * const this)
{
  <bb 2> [local count: 1073741824]:
  MEM[(struct __as_base  &)this_2(D)] ={v} {CLOBBER};
  return;

}



;; Function CompositeClass::~CompositeClass (_ZN14CompositeClassD0Ev,
funcdef_no=1543, decl_uid=28301, cgraph_uid=316, symbol_order=320)

Modification phase of node virtual CompositeClass::~CompositeClass()/320
void CompositeClass::~CompositeClass (struct CompositeClass * const this)
{
  <bb 2> [local count: 1073741824]:
  MEM[(struct __as_base  &)this_2(D)] ={v} {CLOBBER};
  operator delete (this_2(D));
  return;

}



;; Function EmptyClass::EmptyClass (_ZN10EmptyClassC2Ev, funcdef_no=1619,
decl_uid=28257, cgraph_uid=308, symbol_order=312)

Modification phase of node EmptyClass::EmptyClass()/312
void EmptyClass::EmptyClass (struct EmptyClass * const this)
{
  <bb 2> [local count: 1073741824]:
  EmptyClass::EmptyClass (this_1(D)); [tail call]
  return;

}



;; Function EmptyClass::EmptyClass (_ZN10EmptyClassC1Ev, funcdef_no=1536,
decl_uid=28255, cgraph_uid=309, symbol_order=313)

Modification phase of node EmptyClass::EmptyClass()/313
void EmptyClass::EmptyClass (struct EmptyClass * const this)
{
  <bb 2> [local count: 1073741824]:
  return;

}



;; Function boolFunc (_Z8boolFuncv, funcdef_no=1544, decl_uid=28334,
cgraph_uid=317, symbol_order=321)

Modification phase of node bool boolFunc()/321
bool boolFunc ()
{
  <bb 2> [local count: 1073741824]:
  return 1;

}



;; Function main (main, funcdef_no=1555, decl_uid=31596, cgraph_uid=328,
symbol_order=332) (executed once)

Modification phase of node int main(int, char**)/332
int main (int D.31594, char * * D.31595)
{
  void * _3;

  <bb 2> [local count: 1073741824]:
  _3 = operator new (16);
  MEM[(struct __as_base  &)_3] ={v} {CLOBBER};
  MEM[(struct CompositeClass *)_3]._vptr.CompositeClass = &MEM <int (*) ()[4]>
[(void *)&_ZTV14CompositeClass + 16B];
  CompositeClass::~CompositeClass (_3);
  return 0;

}


------

I am wondering if it is because darwin has PIE forced on. The test also fails
on Linux if I force it with -fPIE.

And if so, what is the right move… 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 CompositeClass"
"cp"  } } */
+/* Darwin has PIE which defeats the test.  */
+/* { dg-final { scan-ipa-dump "Speculative outer type:struct CompositeClass"
"cp" { target { ! *-*-darwin* } } } } */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/111083] Test failure of g++.dg/ipa/pr67056.C on darwin
  2023-08-20 16:51 [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin fxcoudert at gcc dot gnu.org
@ 2023-08-20 16:51 ` fxcoudert at gcc dot gnu.org
  2023-08-20 16:59 ` iains at gcc dot gnu.org
  2023-08-21 15:26 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-08-20 16:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111083

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-20
             Status|UNCONFIRMED                 |NEW
               Host|                            |*-*-darwin*
             Target|                            |*-*-darwin*
              Build|                            |*-*-darwin*
      Known to fail|                            |14.0
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/111083] Test failure of g++.dg/ipa/pr67056.C on darwin
  2023-08-20 16:51 [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin fxcoudert at gcc dot gnu.org
  2023-08-20 16:51 ` [Bug c++/111083] " fxcoudert at gcc dot gnu.org
@ 2023-08-20 16:59 ` iains at gcc dot gnu.org
  2023-08-21 15:26 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2023-08-20 16:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111083

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
since this is a scan-dump test, we do not need to execute it - I guess we could
add "-fno-PIE" to the options - AFAIR we will only reject this when linking.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/111083] Test failure of g++.dg/ipa/pr67056.C on darwin
  2023-08-20 16:51 [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin fxcoudert at gcc dot gnu.org
  2023-08-20 16:51 ` [Bug c++/111083] " fxcoudert at gcc dot gnu.org
  2023-08-20 16:59 ` iains at gcc dot gnu.org
@ 2023-08-21 15:26 ` iains at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2023-08-21 15:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111083

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
@honza, adding you because this test also fails on Linux with "-fPIE" - if
that's what you expect then we can handle this just in Darwin, if not expected
- then perhaps something else is needed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-21 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-20 16:51 [Bug c++/111083] New: Test failure of g++.dg/ipa/pr67056.C on darwin fxcoudert at gcc dot gnu.org
2023-08-20 16:51 ` [Bug c++/111083] " fxcoudert at gcc dot gnu.org
2023-08-20 16:59 ` iains at gcc dot gnu.org
2023-08-21 15:26 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).