This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: folding STRING_CST + INTEGER_CST


On Mon, Jun 24, 2002 at 08:23:06PM -0700, Aldy Hernandez wrote:
> 
> > We'd need to ensure that "hello"+3 != "HELlo"+3 (while still having "lo"
> > == "lo"), as well as that (("hello"+3)-3) == "hello", and so on.
> 
> ahhhh!
> 
> another alternative is to fold STRING_CST+INTEGER_CST when we are
> building the trees for certain builtins accepting "const char *".  
> the following come to mind:
> 
> 	strspn, strstr, strcspn, strrchr, strchr, index, fputs
> 
> ...since we know we don't need equality operations on them.

Isn't it guaranteed that: strstr("hello"+3, "lo") != "lo" ?

-Tim


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