https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2021-01-08 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is that __builtin_stack_restore is considered a possible definition by the alias machinery (it needs to be treated as barrier for code motion). check_defs can probably skip __builtin_stack_restore unconditionally (alternatively the uninit pass can stop walking at allocation sites but it's run too early to not need its own tracking of which allocation an object belongs to). diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index 0800f596ab1..33a32eaaa37 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -216,6 +216,9 @@ check_defs (ao_ref *ref, tree vdef, void *data_) return true; return false; } + /* End of VLA scope is not a kill. */ + if (gimple_call_builtin_p (def_stmt, BUILT_IN_STACK_RESTORE)) + return false; /* Found a may-def on this path. */ data->found_may_defs = true; return true; fixes this bug (pre-approved if it tests OK).