This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/58689] New: Enhance returns_nonnull


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58689

            Bug ID: 58689
           Summary: Enhance returns_nonnull
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic, missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
        Depends on: 21856, 24825

For PR 20318, we added an attribute "returns_nonnull". For now, it is quite
basic and only used by fold-const and VRP to assert in callers that the return
value is != 0. However, there are many other things that could be done with it,
see this conversation for details:

http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00498.html
http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00501.html
http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00509.html

This includes in particular:
1) warn if a returns_nonnull function returns null (both using static analysis
and runtime tests);
2) optimize the callee, back-propagating this non-null property and marking as
unreachable the paths that would return 0;
3) preserve the nonnull property when inlining the function (assert_expr?);
4) mark a number of gcc functions with this attribute.

A number of these changes could be shared with the nonnull attribute and
pointer dereferencing.


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