https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104761
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Keywords| |diagnostic Blocks| |104077 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- That's right, the pass never calls mark_dfs_back_edges(). Thanks for the hint. A slightly simplified test case: $ cat pr104761.c && gcc -O1 -S -Wall -fdump-tree-waccess1=/dev/stdout pr104761.c typedef struct { int i; } S; void f (S **); void g (int); void test (int x) { S s = { 0 }; __attribute__((__cleanup__ (f))) S *p = 0; if (x) { g (s.i); for ( ; ; ); } } ;; Function test (test, funcdef_no=0, decl_uid=1986, cgraph_uid=1, symbol_order=0) pr104761.c: In function ‘test’: pr104761.c:15:8: warning: dangling pointer to ‘s’ may be used [-Wdangling-pointer=] 15 | g (s.i); | ^~~~~~~ pr104761.c:9:5: note: ‘s’ declared here 9 | S s = { 0 }; | ^ void test (int x) { struct S * p; struct S s; int _1; <bb 2> : s.i = 0; p = 0B; if (x_5(D) != 0) goto <bb 3>; [INV] else goto <bb 5>; [INV] <bb 3> : _1 = s.i; g (_1); <bb 4> : goto <bb 4>; [INV] <bb 5> : f (&p); s ={v} {CLOBBER(eol)}; p ={v} {CLOBBER(eol)}; return; } Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104077 [Bug 104077] bogus/missing -Wdangling-pointer