[llvm-bugs] [Bug 37274] New: clang issues aligned vptr loads for packed structs

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 27 10:59:58 PDT 2018


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

            Bug ID: 37274
           Summary: clang issues aligned vptr loads for packed structs
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Testcase:

struct [[gnu::packed]] B { virtual void f(); };
static_assert(alignof(B) == 1);
void f(B &b) { b.f(); }

The static_assert passes, and yet Clang generates an aligned vptr load:

  %3 = load %struct.B*, %struct.B** %2, align 8, !dbg !14

GCC appears to correctly handle this case:

  https://godbolt.org/g/GJkafy

-- 
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/20180427/be687ac1/attachment.html>


More information about the llvm-bugs mailing list