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]

Re: PR middle-end/16351 NULL dereference warnings


PING: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01860.html

Actually, the xfailed test was because the function folded to nothing
and the offending code was removed without warning. Fixed in the
attached version. Same changelog.



On 22 July 2015 at 17:52, Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> wrote:
> I took the patch in
> https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01715.html and removed
> the Wnull-attribute part, since most of it can be done from the FE as
> shown in https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01857.html  and
> also to make the patch smaller and easier to review.
>
> I also fixed the comments by Florian here:
> https://gcc.gnu.org/ml/gcc-patches/2014-02/msg00149.html and added
> more tests from the PR and its duplicates (one xfailed, I'll open a
> new PR about it).
>
> Futher cleanups may be possible (infer_nonnull_range_by_attribute
> checks flag_delete_null_pointer_checks, which seems weird to me but it
> matches the existing behavior of infer_nonnull_range).
>
> I added this to Wall to get as much testing as possible, we can always
> move it to Wextra or disable it by default just before the release if
> it turns out to be too noisy.
>
> Boostrapped and regression tested on x86_64-linux-gnu.
>
> OK?
>
> gcc/ChangeLog:
>
> 2015-07-22  Manuel LÃpez-IbÃÃez  <manu@gcc.gnu.org>
>         Jeff Law  <law@redhat.com>
>
>     PR c/16351
>     * doc/invoke.texi (Wnull-dereference): New.
>     * tree-vrp.c (infer_value_range): Update call to infer_nonnull_range.
>     * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour):
>     Warn for potential NULL dereferences.
>     (find_explicit_erroneous_behaviour): Warn for NULL dereferences.
>     * ubsan.c (instrument_nonnull_arg): Call
>     infer_nonnull_range_by_attribute.
>     (instrument_nonnull_return): Likewise.
>     * common.opt (Wnull-dereference); New.
>     * gimple.c (infer_nonnull_range): Remove bool arguments.
>     (infer_nonnull_range_by_dereference): New.
>     (infer_nonnull_range_by_attribute): New.
>     * gimple.h: Update declarations.
>
> gcc/testsuite/ChangeLog:
>
> 2015-07-22  Manuel LÃpez-IbÃÃez  <manu@gcc.gnu.org>
>         Jeff Law  <law@redhat.com>
>
>     PR c/16351
>     * gcc.dg/tree-ssa/isolate-2.c: Close comment.
>     * gcc.dg/tree-ssa/isolate-4.c: Likewise.
>     * gcc.dg/tree-ssa/wnull-dereference.c: New test.
>     * gcc.dg/tree-ssa/isolate-1.c: Test warnings with -Wnull-dereference.
>     * gcc.dg/tree-ssa/isolate-3.c: Likewise.
>     * gcc.dg/tree-ssa/isolate-5.c: Likewise.
>     * c-c++-common/wnonnull-1.c: New test.

Attachment: wnull-dereference.diff
Description: Text document


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