https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119416
Bug ID: 119416
Summary: spurious store with null sanitizer
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: uecker at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
Target Milestone: ---
In the following example, there is an unneeded stack variable and dead store
generated.
void f(int);
int g()
{
int i = 3;
bool ok = true;
f(*({ ok ? &i : 0;}));
}
g:
sub rsp, 24
mov edi, 3
mov DWORD PTR [rsp+12], 3
call f
add rsp, 24
ret
https://godbolt.org/z/ejTohhGhs