public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110846] New: Noinline attribute on a destructor only honored when on the member function declaration, does not wok on definition
@ 2023-07-28 16:49 jamborm at gcc dot gnu.org
2023-07-28 16:53 ` [Bug c++/110846] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-07-28 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110846
Bug ID: 110846
Summary: Noinline attribute on a destructor only honored when
on the member function declaration, does not wok on
definition
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jamborm at gcc dot gnu.org
Target Milestone: ---
When noinline attribute on a destructor, it is honored:
---------- works.C ----------
void f ();
struct test
{
test() {}
[[gnu::noinline]]
~test() { f (); }
};
void
g ()
{
test t;
}
-----------------------------
g++ -O3 -S works.C -fdump-tree-optimized
tail -15 works.C.257t.optimized
;; Function g (_Z1gv, funcdef_no=6, decl_uid=2810, cgraph_uid=7,
symbol_order=6)
void g ()
{
struct test t;
<bb 2> [local count: 1073741824]:
test::~test (&t);
t ={v} {CLOBBER(eol)};
return;
}
But when it is just on the definition, it is not.
---------- doesnot.C ----------
void f ();
struct test
{
test() {}
~test();
};
[[gnu::noinline]]
test::~test()
{
f();
}
void
g ()
{
test t;
}
-------------------------------
~/gcc/trunk/inst/bin/g++ -O3 -S doesnot.C -fdump-tree-optimized
cat doesnot.C.257t.optimized
;; Function test::~test (_ZN4testD2Ev, funcdef_no=4, decl_uid=2799,
cgraph_uid=5, symbol_order=4)
__attribute__((noinline))
void test::~test (struct test * const this)
{
<bb 2> [local count: 1073741824]:
f ();
return;
}
;; Function g (_Z1gv, funcdef_no=6, decl_uid=2814, cgraph_uid=7,
symbol_order=6)
void g ()
{
<bb 2> [local count: 1073741824]:
f ();
return;
}
(Note that the attribute is present in the dump.)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/110846] Noinline attribute on a destructor only honored when on the member function declaration, does not wok on definition
2023-07-28 16:49 [Bug c++/110846] New: Noinline attribute on a destructor only honored when on the member function declaration, does not wok on definition jamborm at gcc dot gnu.org
@ 2023-07-28 16:53 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28 16:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110846
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-07-28
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The clone seems not to have the attribute:
/app/example.cpp:20:1: note: Inlining test::~test()/10 to void g()/6 with
frequency 1.00
_ZN4testD2Ev/10 (test::~test()) @0x7f3fcc1bb220
Type: function definition analyzed
Visibility: semantic_interposition public
next sharing asm name: 4
References: __gxx_personality_v0/9 (addr)
Referring:
Function test::~test()/10 is inline copy in void g()/6
Clone of _ZN4testD2Ev/4
Availability: local
Function flags: body local
Called by: _Z1gv/6 (inlined)
Calls: _Z1fv/8
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-28 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 16:49 [Bug c++/110846] New: Noinline attribute on a destructor only honored when on the member function declaration, does not wok on definition jamborm at gcc dot gnu.org
2023-07-28 16:53 ` [Bug c++/110846] " pinskia 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).