https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119518
Bug ID: 119518
Summary: C++ FE violates noipa attribute
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
Consider:
[[gnu::noipa, noreturn]] void
foo ()
#ifdef DEF
{
for (;;)
;
}
#else
;
#endif
struct S { ~S (); };
void
bar ()
{
S s;
foo ();
}
We get different behavior for -DDEF and without, in one case we assume foo
can't throw and so bar doesn't have S::~S (); call, in the other we don't.
That is against the intent of the "noipa" attribute which is meant to make the
function a black box where callers should work as if the function is not
defined in the TU even when it is.