[Bug inline-asm/101422] register variable uninitialised before passing to asm

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 12 08:14:52 GMT 2021


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Moving the line is the right fix, using register variables is always playing
with fire, as any changes to the registers from evaluation of the expressions
will change value of those register variables.
That can be the case of memset in your testcase for the array initialization,
or e.g. if you divide or modulo in some expression and the CPU requires a
specific register for those etc.
It is recommended to initialize normal automatic variables first and then only
initialize register vars to those automatic variables right before the inline
asm, with no other code in between.


More information about the Gcc-bugs mailing list