https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92346

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to wierton from comment #2)
> This code can reproduce the phenomenon and there are no output constraints.
> I do understand that the declaration %eax in eax is conflict with the inline
> assembly clobber list, but in compiler such as clang, this dependency will
> be detected and clang will extraly generate a move instruction to save the
> eax and the resume it. I think gcc is a mostly widely used compiler, we as
> users expect this compiler becomes better and better, and this feature will
> help improve the usability, so I post it here. Very sorry for previous post.

And the documentation is clear there that this is expected behavior.

https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Local-Register-Variables.html#Local-Register-Variables

"The only supported use for this feature is to specify registers for input and
output operands when calling Extended asm (see Extended Asm)."

"Defining a register variable does not reserve the register. Other than when
invoking the Extended asm, the contents of the specified register are not
guaranteed. For this reason, the following uses are explicitly not supported.
If they appear to work, it is only happenstance, and may stop working as
intended due to (seemingly) unrelated changes in surrounding code, or even
minor changes in the optimization of a future version of gcc:"

Reply via email to