https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108425
Bug ID: 108425
Summary: Invalid DSE
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
Target Milestone: ---
With non-call exceptions we misoptimize following testcase:
struct a{int a,b,c,d,e;};
void
test(struct a * __restrict a, struct a *b)
{
*a = (struct a){0,1,2,3,4};
*a = *b;
}
jan@localhost:/tmp> g++ -O2 q.C -S -fdump-tree-all-details
-fnon-call-exceptions
jan@localhost:/tmp> cat q.C*optimized
;; Function test (_Z4testP1aS0_, funcdef_no=0, decl_uid=2377, cgraph_uid=1,
symbol_order=0)
Scope blocks after cleanups:
{ Scope block #0
}
void test (struct a * restrict a, struct a *b)
{
<bb 2> [local count: 1073741824]:
*a_2(D) = MEM[(const struct a &)b_3(D)];
return;
}
If function is called with b==NULL and the non-call exception is caught, a
should be initialized to {1,2,3,4}.