https://bugs.llvm.org/show_bug.cgi?id=38963

            Bug ID: 38963
           Summary: Warn when dereferencing pointer immediatelly after
                    allocation using malloc
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@lists.llvm.org

void x(void) {
    int *p = (int *)malloc(sizeof(int));
    if (*p)
        abort();
}


LLVM seems to optimize it to just abort() - that's fine. 

But we should warn under -Wuninitialized. Currently, there is no warning when
compiling with -Wall.

+ realloc? aligned_alloc?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to