c/10339: strncmp generates imPure code
Michael Ubell
ubell@mindspring.com
Mon Apr 7 19:05:00 GMT 2003
> I suspect the extra byte read is actually not relevant for the result,
> and because of alignment, gcc knows the second problem cannot occur,
> but I have neither a SPARC nor SPARC knowledge to test that.
>
Actually if you make the compare string longer you can get it
to look at an arbitrary number of bytes passed the allocated part,
so I think this could fault if you set it up right. Also in
the original problem, the first argument was not allocated locally
so the compiler would have no idea how big or what its alignment
was. (In fact it was in a loop comparing strings from an array.)
More information about the Gcc-bugs
mailing list