On 11/28/2017 09:11 PM, Martin Sebor wrote: > On 11/27/2017 02:22 AM, Dominik Inführ wrote: >> Thanks for all the reviews! I’ve revised the patch, the >> operator_delete_flag is now stored in tree_decl_with_vis (there >> already seem to be some FUNCTION_DECL-flags in there). I’ve also added >> the option -fallocation-dce to disable this optimization. It >> bootstraps and no regressions on aarch64 and x86_64. >> > It's great to be able to eliminate pairs of these calls. For > unpaired calls, though, I think it would be even more useful to > also issue a warning. Otherwise the elimination will mask bugs > that might only show up without optimization, or with other > compilers (such as older versions of GCC). I realize GCC doesn't > warn for these bugs involving malloc, but I think it should for > the same reason. Aldy and I looked at this stuff a while ago -- to do anything reasonable you have to build a much stronger static analysis engine than we've got in GCC right now. THe false positive rate will be way too high to be useful on real world code.
I don't see how the optimizatino changes anything WRT warnings though. If you don't have a clear pair where all the proper preconditions are met, then you don't do anything. Those preconditions would include that you actually have a pair as opposed to just the allocation point. Jeff