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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Confirmed.
> 
> <bb 2> [local count: 1073741824]:
> alloc (&q);
> q.0_1 = q;
> *p_4(D) = q.0_1;
> q ={v} {CLOBBER(eol)};
> a_8 = __builtin_memcpy (q.0_1, "", 1);
> *a_8 = 0;
> return;
...
> we somehow confuse q.0_1 = q; as assigning the address of the object 'q'.

The reason for the false positive is plain to see in the IL: the memcpy call is
passed a copy of the clobbered q.  It then returns another copy of the same q
which is then used to dereference whatever the pointer points to.  The warning
is due to the (known) mismatch between how the optimizers and the warning
interpret clobbers: (IIUC) the optimizers treat it as the value of the assigned
variable alone becoming indeterminate, while the warning as all copies of it
becoming so.

Reply via email to