This is the mail archive of the
mailing list for the GCC project.
Re: [patch] builtins.c: Fix PR tree-optimization/15743.
- From: Jeffrey A Law <law at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, roger at eyesopen dot com
- Date: Tue, 01 Jun 2004 22:12:22 -0600
- Subject: Re: [patch] builtins.c: Fix PR tree-optimization/15743.
- Organization: Red Hat, Inc
- References: <firstname.lastname@example.org>
- Reply-to: law at redhat dot com
On Mon, 2004-05-31 at 11:21, Kazu Hirata wrote:
> Attached is a patch to fix PR tree-optimization/15743.
> char *
> foo (void)
> const char *s = "abcd";
> int c = 'p';
> return index (s, c);
> The last tree-ssa form looks like so:
> foo ()
> int c;
> const char * s;
> char * T.0;
> <bb 0>:
> T.0_3 = index ("abcd", 112) [tail call];
> return T.0_3;
> Note that index() is not folded.
> The patch solves this problem by having fold_builtin_1() handle
> index() just like strchr().
> rindex() is handled likewise.
> Tested on i686-pc-linux-gnu. OK to apply?
> Kazu Hirata
> 2004-05-31 Kazu Hirata <email@example.com>
> PR tree-optimization/15743.
> * builtins.c (fold_builtin_1): Fold index() and rindex().
This is fine. Please install this patch. You might also consider
adding your testcase to the testsuite.