From: | ralph@inputplus.demon.co.uk (Ralph Corderoy) |
Newsgroups: | comp.compilers |
Date: | 24 Dec 2001 00:01:02 -0500 |
Organization: | InputPlus Ltd. |
References: | 01-12-050 01-12-118 01-12-121 01-12-123 |
Keywords: | C, optimize |
Posted-Date: | 24 Dec 2001 00:01:02 EST |
Hi Nick,
> nmm1@cus.cam.ac.uk (Nick Maclaren) writes:
> > This is legal, if insane. What is worse, is that strlen is allowed
> > to set errno at whim (C99 7.5 paragraph 3), which makes the whole
> > function effectively unoptimisable.
> >
> > ...
> >
> > [It seems to me that since the compiler is allowed to treat
> > strlen() as a special case, part of the special case could include
> > knowledge that its version of strlen doesn't change errno. -John]
>
> Yes, precisely.
First it's said that because strlen is allowed to set errno the whole
function is effectively unoptimisable. Then, when John points out
that the compiler is allowed to know whether its strlen alters errno,
a possibility not previously allowed for, it's accepted. Doesn't it
completely invalidate the earlier `effectively unoptimisable' point?
AFAICS as an ANSI compiler can know the semantics of strlen, it's not
an obstacle to knowing whether modifying *t affects s.
What's needed is a method of analysis that can determine this.
Ralph.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.