This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to add builtin strncmp and builtin strncpy
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Patch to add builtin strncmp and builtin strncpy
- From: Richard Henderson <rth at redhat dot com>
- Date: Sun, 26 Nov 2000 12:33:41 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- References: <200011261918.OAA07147@caip.rutgers.edu>
On Sun, Nov 26, 2000 at 02:18:33PM -0500, Kaveh R. Ghazi wrote:
> + const int r = strncmp (p1, p2, TREE_INT_CST_LOW (arg3));
> + return expand_expr (build_int_2 (r, 0), target, mode, EXPAND_NORMAL);
This does not properly return a tri-state value because r
is not sign-extended for the build_int_2.
Things are clearer, I think, with
if (r < 0)
return const1m_rtx;
else if (r == 0)
return const0_rtx;
else
return const1_rtx;
anyway.
r~