This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add -fsanitize=pointer-{compare,subtract}.
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Dec 2017 09:36:54 +0100
- Subject: Re: [PATCH] Add -fsanitize=pointer-{compare,subtract}.
- Authentication-results: sourceware.org; auth=none
- References: <4f727889-e597-5aa8-7ada-6f74c332c153@suse.cz> <20171013111719.GG14653@tucnak> <8216fdf0-5a3a-260d-81ac-e81eed58a3ca@suse.cz> <20171013131308.GH14653@tucnak> <27d314e3-4f42-e634-193d-daa7f3b8235b@suse.cz> <20171016122156.GT14653@tucnak> <ad265f59-39f6-648a-7247-90f6b9f8e7e4@suse.cz> <20171016134515.GV14653@tucnak> <26f388e4-8b2f-acab-b7d3-70768f7f1c42@suse.cz> <a72bee09-907d-d6e3-afec-c3c6bcd444e5@suse.cz> <20171205092749.GS2353@tucnak>
On 12/05/2017 10:27 AM, Jakub Jelinek wrote:
> The most important change I've done in the testsuite was pointer-subtract-2.c
> used -fsanitize=address,pointer-subtract, but the function was actually
> doing pointer comparison. Guess that needs to be propagated upstream at
> some point. Another thing is that in pointer-compare-1.c where you test
> p - 1, p and p, p - 1 on the global variables, we need to ensure there is
> some other array before it, otherwise we run into the issue that there is no
> red zone before the first global (and when optimizing, global objects seems
> to be sorted by decreasing size).
Hi.
I've just done review request for that:
https://reviews.llvm.org/D41481
Apart from that I enhanced detect_invalid_pointer_pairs run-time option that
can control whether a pointer comparison (or subtraction) with nullptr is
reported or not:
https://reviews.llvm.org/D41479
Martin