https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108425
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Last reconfirmed| |2023-01-16 Resolution|INVALID |--- Ever confirmed|0 |1 --- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- We do not delete the stmt causing EH. Also the flag does not fix it: jan@localhost:/tmp> gcc -B ./ -O2 q.C -fnon-call-exceptions -S -fdump-tree-all-details -fno-delete-dead-exceptions jan@localhost:/tmp> cat q.C*dse1* ;; Function test (_Z4testP1aS0_, funcdef_no=0, decl_uid=2377, cgraph_uid=1, symbol_order=0) Deleted dead store: *a_2(D).e = 4; Deleted dead store: *a_2(D).d = 3; Deleted dead store: *a_2(D).c = 2; Deleted dead store: *a_2(D).b = 1; Deleted dead store: *a_2(D).a = 0; void test (struct a * restrict a, struct a * b) { <bb 2> : *a_2(D) = MEM[(const struct a &)b_8(D)]; return; } a related testcase: short a; int *null; int test(int val1, int val2) { a=1; int r = val1/val2; a=3; return r; } this shows that the function causing EH may not be visited by the ao walk.