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

            Bug ID: 16942
           Summary: clang should warn about memcmp of pointers to structs
                    with padding
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

This is almost always a bug:


#include <string.h>

struct foo {
  char x; int y;
};

int test(struct foo *P, struct foo *Q) {
  return memcmp(P, Q, sizeof(struct foo));
}

because the padding between the elements of the struct fields is being compared
as well.  It would be nice for clang to warn on this.  LLVM itself tripped over
this recently.

-- 
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