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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to