Patch for builtin strpbrk
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Tue Nov 7 07:52:00 GMT 2000
> From: "Joseph S. Myers" <jsm28@cam.ac.uk>
>
> On Mon, 6 Nov 2000, Kaveh R. Ghazi wrote:
>
> > It transforms the cases where the second argument is a constant
> > string, either "" or "c" where `c' is any one character. I.e.:
> >
> > > strpbrk(foo, "") -> NULL
>
> I trust that in this case it will evaluate foo for its side effects
> (i.e., it doesn't replicate the bug glibc's strpbrk macro had until
> recently)....
You'd think so, given my builtin fputs history...
<...type type type type> :-)
> (There may also be -fcheck-memory-usage issues - i.e., it may need to
> emit the Checker calls to check that the string is readable (see
> expand_builtin_strlen), since the string still is required by the
> standard to be a valid null-terminated string. Though, I don't know
> whether there's a version of Checker that works with current GCC, or
> whether the -fcheck-memory-usage support is at all bitrotten.)
>
> > > strpbrk(foo, "c") -> strchr(foo, c)
I'm not entirely comfortable writing this part. I support I could
just copy bits out of expand_builtin_strlen, however I don't
understand Checker to say whether what I'm doing is correct. Also
since you're not sure Checker actually works, I can't figure it out
through trial and error and test what I come up with.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc-patches
mailing list