shafik added inline comments.

================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:46
+
+  Ptr += sizeof(InitMap *);
   for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
----------------
aaron.ballman wrote:
> shafik wrote:
> > I believe `Ptr` is not longer valid b/c of `free(IM)` b/c what `Ptr` points 
> > to has not been free'ed 
> > 
> > I am looking at the wording now but I am curious what @aaron.ballman thinks.
> How I see it is that it's converting `Ptr` to an `IntMap **`, dereferencing 
> that back to `IntMap *` and then freeing *that* pointer. So it doesn't free 
> `Ptr` itself, but what `Ptr` points to.
Right but the address is no longer valid even if the type we free'ed as is 
different. So the pointer is not longer pointing to a valid location. At least 
that is how I have seen it explained in other contexts but I have to dig up a 
reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136826

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to