▲ | pcfwik 5 days ago | |||||||||||||||||||||||||||||||
Also find it interesting that you're allowing out-of-bounds pointer arithmetic as long as no dereference happens, which is a class of UB compilers have been known to exploit ( https://stackoverflow.com/questions/23683029/is-gccs-option-... ). Do you disable such optimizations inside LLVM, or does Fil-C avoid this entirely by breaking pointers into pointer base + integer offset (in which case I wonder if you're missing out on any optimizations that work specifically on pointers)? | ||||||||||||||||||||||||||||||||
▲ | pizlonator 5 days ago | parent [-] | |||||||||||||||||||||||||||||||
For starters, llvm is a lot less willing to exploit that UB It’s also weird that GCC gets away with this at all as many C programs in Linux that compile with GCC make deliberate use of out of bounds pointers. But yeah, if you look at my patch to llvm, you’ll find that: - I run a highly curated opt pipeline before instrumentation happens. - FilPizlonator drops flags in LLVM IR that would have permitted downstream passes to perform UB driven optimizations. - I made some surgical changes to clang CodeGen and some llvm passes to fix some obvious issues from UB But also let’s consider what would happen if I hadn’t done any of that except for dropping UB flags in FilPizlonator. In that case, a pass before pizlonation would have done some optimization. At worst, that optimization would be a logic error or it would induce a Fil-C panic. FilPizlonator strongly limits UB to its “memory safe subset” by construction. I call this the GIMSO property (garbage in, memory safety out). | ||||||||||||||||||||||||||||||||
|