[cfe-dev] Is this a clang bug? (asm + register + aarch64)

Tim Northover via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 3 13:14:27 PDT 2016


Hi Alex,

On 30 September 2016 at 07:13, via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> I would expect the x2 argument register to be saved and restored when used
> beyond an asm block. The movs between x2 and x19 oddly seem to be in the
> wrong direction. Register x19 is later used with  an unexpected value and
> the program segfaults.  Is this a bug or the expected behaviour? The
> architecture is aarch64.

Nothing in the snippet you posted clobbers x2 so I'd expect that to be
valid code. If your inline asm block makes actual function calls then
it needs to mark the registers that don't get preserved as clobbered.
LLVM won't inspect the string looking for a function call or infer its
ABI.

Cheers.

Tim.



More information about the cfe-dev mailing list