Re: Ada vs. C performance, was Possible to write compiler to

Christopher Glaeser <cdg@nullstone.com>
17 Jan 1997 23:40:49 -0500

          From comp.compilers

Related articles
Ada vs. C performance, was Possible to write compiler to Java VM? robison@kai.com (Arch Robison) (1997-01-07)
Re: Ada vs. C performance, was Possible to write compiler to Dave_Koogler_at_CCISDAPPS1@ppc-191.putnaminv.com (1997-01-09)
Re: Ada vs. C performance, was Possible to write compiler to burley@gnu.ai.mit.edu (Craig Burley) (1997-01-12)
Re: Ada vs. C performance, was Possible to write compiler to toon@moene.indiv.nluug.nl (Toon Moene) (1997-01-14)
Re: Ada vs. C performance, was Possible to write compiler to cdg@nullstone.com (Christopher Glaeser) (1997-01-17)
| List of all articles for this month |

From: Christopher Glaeser <cdg@nullstone.com>
Newsgroups: comp.compilers
Date: 17 Jan 1997 23:40:49 -0500
Organization: Nullstone Corporation
References: 97-01-045 97-01-065 97-01-078 97-01-111
Keywords: C, performance

Toon Moene wrote:


> subroutine saxpy(n,sa,sx,incx,sy,incy)
> real sx(*),sy(*),sa
> integer i,incx,incy,ix,iy,n


<stuff deleted>


> The problem here, for the gcc backend, is that the arguments to the
> Fortran routine are implemented in g77 as "call-by-reference",
> i.e. pointers to their values in memory are passed. The C semantics
> doesn't promise anything about aliasing of pointers 1); therefore, the
> backend _currently_ assumes that the store into sy invalidates the
> values of sa, incx and incy in the loop.


I'm not sure if you are refering to the standard or the gcc
implementation, but just to make sure, the ANSI C standard "does
promise" some things about aliasing of pointers. For example, a
pointer to the real variable sy can not point to the integer variables
incx or incy (in an ANSI C compliant program). The gcc implementation
may invalidate incx and incy on a store to sy, but this is not
required by the ANSI C standard.


Best regards,
Christopher Glaeser cdg@nullstone.com
Nullstone Corporation http://www.nullstone.com
[True, but in this example, even the potential aliasing of variables
of the same type kills most optimizations. -John]


--


Post a followup to this message

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