This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Warn on and fold NULL checks against inline functions
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 26 May 2014 16:56:02 -0400
- Subject: Re: [PATCH] Warn on and fold NULL checks against inline functions
- Authentication-results: sourceware.org; auth=none
- References: <1401130917-4121-1-git-send-email-patrick at parcs dot ath dot cx> <alpine dot DEB dot 2 dot 10 dot 1405262222080 dot 2086 at laptop-mg dot saclay dot inria dot fr>
On Mon, May 26, 2014 at 4:26 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Mon, 26 May 2014, Patrick Palka wrote:
>
>> This patch teaches the C++ frontend to warn on NULL checks against
>> inline functions and it teaches the middle-end to fold NULL checks
>> against inline functions. These two things are currently done for
>> non-inline C++ functions, but inline functions are exceptional in that
>> the C++ frontend marks them as weak, and NULL checks against weak
>> symbols cannot be folded in general because the symbol may be mapped to
>> NULL at link-time.
>>
>> But in the case of an inline function, the fact that it's a weak symbol
>> is an implementation detail. And because it is not permitted to
>> explicitly give an inline function the "weak" attribute (see
>> handle_weak_attribute), in order to acheive $SUBJECT it suffices to
>> assume that all inline functions are non-null, which is what this patch
>> does.
>
>
> Thanks for working on this. You may want to mention PR 59948 in the
> ChangeLog. In the comments of that PR, Honza seems to have a different idea
> of what the fold-const test should look like.
I wonder, then, if the test in c-common.c is also broken... Thanks
for the heads up about the PR.