This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize strlen comparisons against zero (take 2)
- To: Richard Henderson <rth at redhat dot com>
- Subject: Re: [PATCH] Optimize strlen comparisons against zero (take 2)
- From: Roger Sayle <roger at eyesopen dot com>
- Date: Fri, 9 Nov 2001 15:55:40 -0700 (MST)
- cc: <gcc-patches at gcc dot gnu dot org>
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
--