[llvm-bugs] [Bug 31787] Incorrect warning about uninitialized variable with `asm`

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 30 09:20:31 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31787

Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rnk at google.com
         Resolution|---                         |INVALID

--- Comment #1 from Reid Kleckner <rnk at google.com> ---
The warning is correct in our model. This code has undefined behavior. Clang's
register variables do not really give you access to the underlying register.
They only add implicit input and output operands to every fragment of inline
asm in your function.

Here's an example showing what clang does:

$ echo 'void *f() { register void *got asm("%ebx"); return got; }' | clang -cc1
-x c - -O1 -S
        .text
        .def     f;
        .scl    2;
        .type   32;
        .endef
        .globl  f
        .p2align        4, 0x90
f:
        retq

I think there's already a bug somewhere about changing the behavior to be more
like GCC, but the consensus is that we won't implement register variables,
global or local.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170130/4091d5f3/attachment.html>


More information about the llvm-bugs mailing list