[llvm-bugs] [Bug 44435] New: clang does not fully grok 'register asm("x")' declarations for powerpc

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 1 20:40:58 PST 2020


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: unassignedclangbugs at nondot.org
          Reporter: chmeeedalf at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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 at ralga:pts/12]:~> ./test_regasm
4611686018427378136, 1

Built with gcc9:
[chmeee at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200102/9adb8c5f/attachment.html>


More information about the llvm-bugs mailing list