[LLVMbugs] [Bug 18140] New: Clang should diagnose when parameter alignment will not be honored due to the ABI

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 4 16:48:10 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18140

            Bug ID: 18140
           Summary: Clang should diagnose when parameter alignment will
                    not be honored due to the ABI
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat t.cpp
struct S {
  ~S();
  __declspec(align(16)) char thing[16];
};
void thing(S a, int b, S c) {}
int main() {
  S s;
  thing(s, 1, s);
}

$ cl -c t.cpp -nologo
t.cpp
t.cpp(5) : error C2719: 'a': formal parameter with __declspec(align('16'))
won't be aligned
t.cpp(5) : error C2719: 'c': formal parameter with __declspec(align('16'))
won't be aligned

$ clang -cc1 -triple i686-pc-win32 t.cpp -emit-llvm -o - | grep byval
define void @_Z5thing1SiS_(%struct.S* byval align 4, i32 %b, %struct.S* byval
align 4) #0 {
  call void @_Z5thing1SiS_(%struct.S* byval align 4 %agg.tmp, i32 1, %struct.S*
byval align 4 %agg.tmp1)

We don't emit a diagnostic, and our use of 'byval align 4' here indicates that
we will not attempt to align the struct to more than 4 bytes.  Code in
lib/CodeGen/TargetInfo.cpp implements this.

-- 
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/20131205/5d71657f/attachment.html>


More information about the llvm-bugs mailing list