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: [PATCH] Optimize strlen comparisons against zero (take 2)



On Fri, 9 Nov 2001, Richard Henderson wrote:
> > tree cst_char_node = build_type_variant (char_type_node, 1, 0);
> > tree cst_char_ptr_node = build_pointer_type (cst_char_node);
>
> Is this cast necessary?  I'd have thought the argument should have
> already been of const char * type due to the function's prototype.

I wasn't sure about that myself.  The model I was using was the
cast to "const unsigned char*" in expand_builtin_strcmp.  I wasn't
sure whether these casts were applied explicitly in the tree or
expanded as part of the function call.  If the later, then removing
the function call would strip the implicit cast.  Either way applying
a cast explicitly here could do no harm.

Feel free to try a bootstrap and test the testcase without the cast
above.  I'd try it here but I'm having problems with the bootstrap.

Roger
--


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