On Tue, Aug 1, 2017 at 11:23 AM, Richard Biener <richard.guent...@gmail.com> wrote: > On Tue, Aug 1, 2017 at 4:27 AM, Martin Sebor <mse...@gmail.com> wrote: >> Richard, >> >> in discussing this work Jeff mentioned that your comments on >> the tree-ssa-alias.c parts would be helpful. When you have >> a chance could you please give it a once over and let me know >> if you have any suggestions or concerns? There are no visible >> changes to existing clients of the pass, just extensions that >> are relied on only by the new diagnostics. >> >> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01264.html >> >> I expect to revisit the sprintf %s patch mentioned below and >> see how to simplify it by taking advantage of the changes >> implemented here. > > Your ptr_deref_alias_decl_p returns true when must_alias is true > but there is no must-alias relationship. > > The ao_ref_init_from_ptr_and_size doesn't belong there. > > I dislike all of the changes related to returning an alias "size". > > Please keep away from the alias machinery. > > Warning during folding is similarly bad design. Please don't add > more such things. > > Thanks for putting this on my radar though. > Richard.
Oh, for a constructive comment this all feels like sth for either sanitizers or a proper static analysis tool. As I outlined repeatedly I belive GCC could host a static analysis tool but it surely should not be interwinded into it's optimization passes or tools. Richard. > >> Thanks >> Martin >> >> >> On 07/24/2017 09:13 PM, Martin Sebor wrote: >>> >>> Ping: >>> >>> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01264.html >>> >>> This change is related to >>> >>> [PATCH] enhance -Wrestrict for sprintf %s arguments >>> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01176.html >>> >>> On 07/20/2017 02:45 PM, Martin Sebor wrote: >>>> >>>> With more testing (building GDB, Glibc, Busybox, and the Linux >>>> kernel) I found a few bugs and weaknesses in the initial patch. >>>> Attached is version 2 that fixes the uncovered problems and makes >>>> further enhancements to handle more cases. >>>> >>>> Martin >>>> >>>> On 07/16/2017 05:47 PM, Martin Sebor wrote: >>>>> >>>>> Being implemented in the front end, the -Wrestrict warning >>>>> detects only trivial instances of violations. The attached >>>>> patch extends the implementation to the middle-end where >>>>> data flow and alias analysis can be combined to detect even >>>>> complex cases of overlap. This work is independent of but >>>>> follows on the patch below (waiting for review): >>>>> >>>>> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00036.html >>>>> >>>>> The changes rely on extending the tree-ssa-{alias,structalias} >>>>> machinery in a simple way to answer the "must-alias" kind of >>>>> question in addition to the current "may-alias." >>>>> >>>>> The rest of the changes are in gimple-fold.c, tree-ssa-strlen.c, >>>>> and builtins.c. >>>>> >>>>> Even though this change makes -Wrestrict a lot more useful, it's >>>>> not a complete implementation. Not all built-ins are handled yet >>>>> (e.g., strncat), and support for user-defined functions is still >>>>> subject to the limitations of the front end implementation. To >>>>> complete the support, handlers for the missing string built-ins >>>>> will need to be added to tree-ssa-strlen.c, and the remaining >>>>> bits should be moved from the front end to somewhere in >>>>> the middle-end (e.g., calls.c). >>>>> >>>>> Martin >>>> >>>> >>> >>