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]

Re: Patch to add builtin strncmp and builtin strncpy


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~

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