Re: Possible ANSI C Optimisation Done in Practice?

ralph@inputplus.demon.co.uk (Ralph Corderoy)
24 Dec 2001 00:01:02 -0500

          From comp.compilers

Related articles
[7 earlier articles]
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? RLWatkins@CompuServe.Com (R. L. Watkins) (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-22)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-22)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? toon@moene.indiv.nluug.nl (Toon Moene) (2001-12-24)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-27)
Re: Possible ANSI C Optimisation Done in Practice? david.thompson1@worldnet.att.net (David Thompson) (2001-12-27)
Re: Possible ANSI C Optimisation Done in Practice? david.thompson1@worldnet.att.net (David Thompson) (2002-01-03)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2002-01-05)
| List of all articles for this month |
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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.