[PATCH] D94640: adds more checks to -Wfree-nonheap-object

Karl-Johan Karlsson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 4 04:01:27 PST 2021


Ka-Ka added a comment.

This patch seems to introduce warnings for the case

#include <stdlib.h>
#include <stdint.h>
void foo(void* ptr)
{

  free((void*)(intptr_t) ptr);

}

something that gcc don't warn for (see https://godbolt.org/z/1WT9c6 ).

As intptr_t is suppose to be used to pass pointers in I think its a bit strange that clang warns in this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94640/new/

https://reviews.llvm.org/D94640



More information about the cfe-commits mailing list