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

            Bug ID: 44435
           Summary: clang does not fully grok 'register asm("x")'
                    declarations for powerpc
           Product: clang
           Version: 9.0
          Hardware: Other
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

This may be a general bug, but I've only tested on powerpc64.

libreoffice uses asm register allocations a'la:

register long r3 asm("r3");

With gcc, it allocates register r3 to the variable, but clang ignores the asm
bit, and treats it as an uninitialized variable, leading to crashes in
libreoffice.

A trivial example program:

#include <stdio.h>

int main(int argc, char **argv)
{
        register long x asm("r3");

        printf("%ld, %d\n", x, argc);
        return (0);
}


Built with clang:
[chmeee@ralga:pts/12]:~> ./test_regasm
4611686018427378136, 1

Built with gcc9:
[chmeee@ralga:pts/12]:~> ./test_regasm
1, 1

r3 on entry is argc, so it should print 1 for both arguments.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to