On Mon, Sep 14, 2020 at 7:35 AM Jakub Jelinek <ja...@redhat.com> wrote: > > On Sat, Sep 12, 2020 at 10:11:36AM -0700, H.J. Lu via Gcc-patches wrote: > > Clobbering the stack pointer in asm statment has been deprecated. Adding > > the stack pointer register to the clobber list has traditionally had some > > undocumented and somewhat obscure side-effects, including ICE. Issue > > a warning and ignore the clobbered stack pointer in asm statment. > > > > gcc/ > > > > PR target/97032 > > * cfgexpand.c (asm_clobber_reg_kind): New enum. > > (asm_clobber_reg_is_valid): Renamed to ... > > (get_asm_clobber_reg_kind): This. Ignore the stack pointer. > > (expand_asm_stmt): Replace asm_clobber_reg_is_valid with > > get_asm_clobber_reg_kind. Skip ignored clobbered register. > > AFAIK in the PR52813 discussions it was mentioned that the sp clobbers > had some user visible effects like forcing no red-zone, or (at least for > some GCC versions) forcing frame pointer in the function containing the asm. > Such clobbers are deprecated since GCC 9, so I think e.g. this patch isn't > really backportable to 9 branch. Are we ready to stop that behavior? > And if yes, shouldn't we instead just error on this because a warning > clearly doesn't help, as users ignore warnings (at least in firefox this > isn't fixed yet)? > Is there some other way to fix the ICE (mark functions containing that and > perhaps penalize the code, in this case e.g. by perhaps forcing unnecessary > realignment, but not ICE)?
For GCC 8/9, we can inform the backend that SP is clobbered by asm statement and each backend can mitigate its impact. -- H.J.