Uros Bizjak <ubiz...@gmail.com> writes: > diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c > index 21bdcdaeaa35..691e0c7c1b0b 100644 > --- a/gcc/cfgexpand.c > +++ b/gcc/cfgexpand.c > @@ -2981,6 +2981,14 @@ expand_asm_stmt (gasm *stmt) > regname); > return; > } > + else if (!in_hard_reg_set_p > + (accessible_reg_set, reg_raw_mode[reg], reg)) > + { > + /* ??? Diagnose during gimplification? */ > + error ("the register %qs cannot be clobbered in %<asm%>" > + " for the current target", regname); > + return; > + } > > SET_HARD_REG_BIT (clobbered_regs, reg); > rtx x = gen_rtx_REG (reg_raw_mode[reg], reg);
There's an argument that clobbering an inaccessible register should simply be a no-op, so that e.g. you can describe a syscall ABI's effect on FP registers without having to check whether FP registers are disabled. But if an asm explicitly uses the clobbered register, it would be surprising not to at least warn. Since we can't reliably distinguish the two cases, I agree going for the safest is best. So OK (for GCC 10, like you say) if no-one objects in the meantime. Thanks, Richard