[llvm-bugs] [Bug 40413] New: __attribute__((preserve_most)) saves 64-bit registers on 32-bit builds.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 22 12:47:12 PST 2019


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

            Bug ID: 40413
           Summary: __attribute__((preserve_most)) saves 64-bit registers
                    on 32-bit builds.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brian.peter.ledger at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Building 

```
void foo();

__attribute__((preserve_most))
int bar(int num) {
    foo();
    return 0;
}
```

produces the expected pushl and popl commands for saving registers. However,
they are ranging over the set of 64-bit registers, even when -m32 is passed.

If you inspect at line 290 of llvm/lib/Target/X86/X86RegisterInfo.cpp in the
repository, you will see it is referring to the constant
CSR_64_RT_MostRegs_SaveList, which is the set of 64-bit registers.


This will cause the assembler to fail, citing invalid registers, for all 32-bit
targets that use __attribute__((preserve_most)).

-- 
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/20190122/adba1d14/attachment.html>


More information about the llvm-bugs mailing list