https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109545
Bug ID: 109545
Summary: first_stmt has strange semantics
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
tree-cfg.cc:first_stmt skips debug stmts but not labels which is quite odd and
can lead to compare-debug issues.
Users are
./tree-cfgcleanup.cc: stmt = first_stmt (dest);
./tree-cfgcleanup.cc: label = first_stmt (dest);
./omp-expand.cc: && first_stmt (store_bb) == store
./tree-vect-slp.cc: if (gcall *first = safe_dyn_cast <gcall *> (first_stmt
(bb)))
./gimple-loop-versioning.cc: gimple *stmt = first_stmt (loop->header);
./cp/cp-gimplify.cc: return first_stmt (p->stmt);
./cp/cp-gimplify.cc: return first_stmt (BIND_EXPR_BODY (stmt));
./cp/cp-gimplify.cc: tree ft = first_stmt (then_);
./cp/cp-gimplify.cc: tree fe = first_stmt (else_);
./tree-cfg.h:extern gimple *first_stmt (basic_block);
./tree-cfg.cc: then_stmt = first_stmt (then_bb);
./tree-cfg.cc: else_stmt = first_stmt (else_bb);