c/10339: strncmp generates imPure code
Andreas Schwab
schwab@suse.de
Mon Apr 7 19:26:00 GMT 2003
Michael Ubell <ubell@mindspring.com> writes:
|> > 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.)
Could you please provide a test case that actually shows the problem?
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc-bugs
mailing list