AliveToolkit / alive2

Automatic verification of LLVM optimizations
MIT License
776 stars 98 forks source link

Add support for C++'s new operators #101

Open aqjune opened 5 years ago

aqjune commented 5 years ago

It is not clear whether

p = malloc()
delete p

and

p = new X()
free(p)

is okay in LLVM IR. This should be clarified.

aqjune commented 4 years ago

https://isocpp.org/wiki/faq/freestore-mgmt#mixing-malloc-and-delete says it is not allowed:

there is no guarantee that the mechanism used by new and delete to acquire and release raw memory is compatible with malloc() and free(). If mixing styles works on your system, you were simply “lucky” – for now.
aqjune commented 3 years ago

Another link that might be helpful: https://reviews.llvm.org/D95095 It looks like a new operator has more freedom to do 'things'.