[LLVMbugs] [Bug 9527] New: warn if class type has alignment greater than "new" provides and doesn't overload operator new

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 21 22:01:45 PDT 2011


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

           Summary: warn if class type has alignment greater than "new"
                    provides and doesn't overload operator new
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


I'd like a new warning that fires whenever a class has alignment that is larger
than that provided by the operator new, and doesn't provide its own operator
new. We could make it -Wobject-alignment=16 and off by default.

Sample:

  class Test {
    template <typename T>
    struct SeparateCacheLines {
      T data;
    } __attribute__((aligned(64)));

    SeparateCacheLines<int> high_contention_data[10];
  };

I'd like a warning that fires on class Test, "class Test can not be heap
allocated". It should not fire if operator new is overloaded. It should not
fire on SeparateCacheLines<> itself.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list