[Bug c/38925] gcc ignores use of %rbp via assembly, generates bad code
thutt at vmware dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 21 13:06:00 GMT 2009
------- Comment #5 from thutt at vmware dot com 2009-01-21 13:06 -------
(In reply to comment #2)
> I think this code is undefined as you are using uninitialized variables for
> input of the inline-asm.
>
I disagree.
The registers are intended to have their *current*
values saved across the 'vmrun' instruction. Since it's
not possible to specify registers R8 through R15 in constraints, bug
16331 suggests this obtuse workaround.
The intent of this code is twofold: demonstrate the assginment of
two variables to '%rbp' and to show that it's not possible to
show clobber an arbitrary set of registers. It does both well.
Furthermore, if you'd take the code and compile with all the initializations,
in place, you would have seen that it makes no difference whatsoever: two
variables are assigned to '%rbp', just the same.
But, all the initializations also make the code incorrect: the point is to
either save all the registers across the 'vmrun' instruction, or to
clearly indicate to the compiler that all the registers are clobbered
at the end of the 'vmrun' instruction.
--
thutt at vmware dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|inline-asm |c
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38925
More information about the Gcc-bugs
mailing list