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

             Bug #: 12289
           Summary: -Wsizeof-pointer-memaccess doesn't catch memset(
                    itemInfo, 0, sizeof( &itemInfo ) )
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


The following program does not produce a warning when compiling with
-Wsizeof-pointer-memaccess

#include <cstring>

struct Foo {};

int main() {
    Foo p, *itemInfo = &p;

    std::memset( itemInfo, 0, sizeof( &itemInfo ) );

}

If the memsset line were slightly different, a warning would be generated:

memset( itemInfo, 0, sizeof( itemInfo ) );

This code was tested due to the following article (Example 1):

http://www.viva64.com/en/a/0079/#ID0EYKAG

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

Reply via email to