This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING #2] [PATCH] enhance -Wrestrict to handle string built-ins (PR 78918)


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.

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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]