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: [cond-optab, trunk] fold &f != 0 better


On Thu, Apr 9, 2009 at 1:36 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
>
>>> Index: gcc/fold-const.c
>>> ===================================================================
>>> --- gcc/fold-const.c ? ?(branch cond-optab)
>>> +++ gcc/fold-const.c ? ?(working copy)
>>> @@ -15011,8 +15011,8 @@ tree_single_nonzero_warnv_p (tree t, boo
>>> ? ? ? ? ?return false;
>>>
>>> ? ? ? ?/* Weak declarations may link to NULL. ?*/
>>> - ? ? ? if (VAR_OR_FUNCTION_DECL_P (base))
>>> - ? ? ? ? return !DECL_WEAK (base);
>>> + ? ? ? if (DECL_P (base))
>>> + ? ? ? ? return !VAR_OR_FUNCTION_DECL_P (base) || !DECL_WEAK (base);
>>
>> Hmm, I think this misses && flag_delete_null_pointer_checks, otherwise
>> a VAR_DECL may be at address zero. ?I'm not sure if that would apply
>> for PARM_DECLs, LABEL_DECLs, etc.
>>
>> Thus, the patch is ok if you add && flag_delete_null_pointer_checks to
>> the VAR_OR_FUNCTION_DECL_P case.
>
> Good catch. ?I'll make the condition "if (DECL_P (base) &&
> !flag_delete_null_pointer_checks" just to be safe. ?If a function can be

^^^ not ! obviously.

Richard.

> at address zero (a interrupt handler can be there on the Z80, I don't
> have any more modern example...), a label can be there too.
>
> Paolo
>


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