https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104880
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot
gnu.org
Keywords| |ice-on-valid-code
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interestingly it only fails with -fno-checking, with -fchecking it works fine.
A diff -fchecking vs -fno-checking reveals
--- a/t.cc.031t.einline 2022-03-11 13:42:58.925057781 +0100
+++ b/t.cc.031t.einline 2022-03-11 13:43:04.713135650 +0100
@@ -47,25 +47,25 @@
void n::j (struct n * const this)
{
struct h k(address-taken);
- __int128 unsigned a(address-taken);
+ __int128 unsigned a;
__int128 unsigned _1;
__int128 unsigned _5;
<bb 2> :
k(address-taken) ={v} {CLOBBER};
- k(address-taken).D.2425 = MEM[(const struct c &)&a(address-taken)];
+ k(address-taken).D.2425 = MEM[(const struct c &)&a];
_5 = g::h::ad (&k(address-taken));
<bb 3> :
_1 = _5;
- __atomic_compare_exchange_16 (&f(address-taken), &a(address-taken), _1, 1,
3, 0);
- a(address-taken) ={v} {CLOBBER(eol)};
+ __atomic_compare_exchange_16 (&f(address-taken), &a, _1, 1, 3, 0);
+ a ={v} {CLOBBER(eol)};
k(address-taken) ={v} {CLOBBER(eol)};
return;
<bb 4> :
<L0>:
- a(address-taken) ={v} {CLOBBER(eol)};
+ a ={v} {CLOBBER(eol)};
k(address-taken) ={v} {CLOBBER(eol)};
resx 1
where the -fno-checking case loses the TREE_ADDRESSABLE flag as part of
early inlining. We have
if (optimize_atomic_compare_exchange_p (stmt))
{
/* For __atomic_compare_exchange_N if the second argument
is &var, don't mark var addressable;
if it becomes non-addressable, we'll rewrite it into
ATOMIC_COMPARE_EXCHANGE call. */
tree arg = gimple_call_arg (stmt, 1);
gimple_call_set_arg (stmt, 1, null_pointer_node);
gimple_ior_addresses_taken (addresses_taken, stmt);
gimple_call_set_arg (stmt, 1, arg);
}
but that rewriting doesn't actually happen, that's because 'a' has partial
defs (but we cannot rely on that here). So this optimization looks
premature. What restores the TREE_ADDRESSABLE bit with -fchecking is
verify_ssa_operands which also fails to diagnose a missing bit
(and to restore the non-set status here).