C Versus Fortran-77 for Scientific Programming

The predominant programming language for numeric and scientific applications is Fortran-77 and supercomputers are primarily used to run large-scale numeric and scientific applications. Standard C* is not widely used for numerical and scientific programming, yet Standard C provides many desirable linguistic features not present in Fortran-77. Furthermore, the existence of a standard library and preprocessor eliminates the worst portability problems. A comparison of Standard C and Fortran-77 shows several key deficiencies in C that reduce its ability to adequately solve some numerical problems. Some of these problems have already been addressed by the C standard but others remain. Standard C with a few extensions and modifications could be suitable for all numerical applications and could become more popular in supercomputing environments.


INTRODUCTION
Standard C and Fortran-?? are the two most prevalent languages used on supercomputt'r,;. A comparison of Standard C and Fortran-T! shows that C contains a wider variety of data types, eloquent sequence controL a standard preprocessor. wider variety of memory allocation options, communication with the program's environment. and additional operators not present in Fortran-77. ~lany desirable linguistic features provided by Standard C are not present in Fortran--::. Fortran's major strength i~ its optimization potential. High performance capability is as important as any language featurt' in the numerical and scientific arena, and this is especially true for supncomputing environment~. Additional a<h-antages of Fortran-77 are support of a complex data type. adjustable arrays. a,;,.;umed size arrays. and in-trin~ic functions for the standard math function,. ;. The following is an analysis of the strengths and weakne~se~ of Standard C and Fortran-77 from a numerical programming perspective. The intent is to provide useful information to someone trying to decide which programming language to use for numerical and scientific programming. There i~ a Fortran-90 standard that is not considered in this article because. unlike Fortran-"77. it does not vet have a successful history against which to compare. There is also a discussion of enhancements being considered by committee X:3J11.1 the l\umerical C Extensions Group (l\CEG ). Their goal is to produce a quality technical report proYiding 99 implementers with a formal definition of several new features. These features will enhance C's support for numerical and scientific programming, and will be upward compatible with the C standard.

Data Types
Standard C defines a richer set of data types than found in the Fortran-77 standard. Scalar types not present in Fortran-?? include unsigned integers, pointers, and enumerated constants. The follo-wing is a list of integer types in Standard C (though there are other ways to declare these types): signed char unsigned char signed short unsigned short signed int unsigned int signed long unsigned long enumeration l_lpe An enumeration type provides a mechanism for specifying named integer constants. The following example shows an enumeration type with four members: enum color { red, green, blue, none "" -1 }; The enumeration type also provides an automatic numberin_g facility for each uninitialized named member. The value of member red is 0, member Example 1 struct s_tag { green is 1, and member blue is 2. Furthermore. the automatic numbering can be restarted by assigning a specific value to a member. Thus. member none starts the sequence over with the value -1. Yariables can be declared to have an enumeration type and assigned the values of the enumeration members.
enum color pixel = none; Fortran-77 prm·ides only a single signed integer type. l\amed constants can be specified in Fortran-?? with the PARAMETER statement. but the useful automatic numbering feature is not accommodated.
PARAMETER (NAME = 7) l\o pointer type is found in Fortran-77, which limits the expressiveness of the language but also turns out to be an aid to optimizations. The semantics of Standard C pointers introduces more aliasing, that is hidden from the compiler. ~Iany optimizations depend on the compiler's ability to identify aliasing. Aliasing issues are explored in detail in section "4.4 C Aliasing." Standard C pointers provide easv access to dvnamicalh· allocated memory and a~e discussed in more d~tail in section '·2.6 ~lemory Allocation.,. Standard C pointers turn out to be a blessing and a curse. They provide expressive power but at considerable cost in lost efficiencY. Standard C provides multiple aggregate types also. There are structures. unions. and  The physical layout of memory can be spt>cified to a fine ~ranularity with Standard C"s structure:;. lnte~ral memlwr:'i can be declared to occupy an arbitran· number of bits within a memon· word . . (callt>d a bitfiekn allowing table layouts to be mapped preci,.;ely and portably. This control makes it much eaiiit>r to conserYe memmT in a standard portable manner.

Type Synonyms
Standard C supports the declaration of a synonym for all declarable type,.; with thetypedefkeyword. This allow,.; a complicated type to be reprt>sented with a sn1onnn.  \JO.YS. This ability to encapsulate a complicated concept with a single meaningful name is very powerful, and an aid to both portability and maintainability. A single typedef dec-laration can be changed (from say. an array of 100 elemt'nb to an array of 1,000 elements) and t>very va1iable declared with that typedef name is automatically changed. This expressive typing mechani,..;m is a definite advantage that Standard C has over Fortran-::.

Flow of Control
Standard C contains eloquent sequence control ,..;tatements alon~ with nested scopes that facilitate the u,.;e of structured programming techniques. Standard C contains if, if-else, for, while, do-while, and switch statements. This cadre of sequence control statements is complemt'nted with the following statements that nicely alter tht> flow of control through a program: I* modify loop limit expression *I *p = iz [i]; I* IPI might alias IiI or } I* trip count is data dependent *I for (p = head; p '= NULL; p = p->next l p->data++; } Standard C semantics requires analysis of the entire containintr function to compute a loop"s trip count. Although trying to dPtPrmine if the trip count can be computed prior to entering the loop requires con,;iderable analysis. it is not an insurmountable problem. Iris not too onerous to adopt a codinl! style that allows the compiler to precompute the trip count. In the final analysis. the rich flow of control mechanisms available with Standard C is another one of its advantages.

C Preprocessor
Standard C has a prPprocessor that permits source code inclusion. conditional source ,,xclu-In I *I sion. and macro definition,;. Source inclu;;ion i,; accomplished through the prepn>ces:-;ing directi\·e #include. which cmbes the sow-ce line containing the directive to be replaced with the contenh of the specified file. Sourct' inclu;;ion pt>nnih a standard set of declaration,; to be included in all compilation unih 'i.e .. sourct· files allm\·ing an interface to a set of library function,;; tn he implementation dept>ndt>nt yet hiddPn from thP prof!rammer.
#include "common.h" I* common library interface *I Conditional soun·p exclusion allow;; source code to be tailored to specific enYirnnments. The #if. #el if. #else" and #end if directiye;; provide this conditional sourct' exclthion capability.
#include <limits.h> see section 2.5  .\lacro definitions allow a complicated operation or set of statements to be defined with a function-*I C \ERSCS FORTRA:\1-77 103 like description that enhances portability and maintainability. The following macro definition: #define ROOT(a, b, c) is an example of how a cryptic expression can be f!iven a meaningful name through a macro definition. SimilarlY. access to critical data o;tructures can Le encapsulated with macro definitions that improve the flexibility and comprehensibility of the program. The following example: #define denom(X, I) (X->table[I).denom) allows a complicated data reference to be given a meaningful name that avoids using many long cryptic expressions. In all fairness to Fortran-::. it does permit the declaration of statement functions that proYide a subset of the C macro definition capability. The presence of c· s built-in preprocessor is a tremendous asset to writing both portable and maintainable programs.
The C preprocessor is often Yiewed as an ad-Yantage by Fortran programmers ro the extent that C preprocessing directiYes and macros are sometimes inserted into Fortran programs. However. the C preprocessor is not a part of the Fortran-:: standard. The C preprocessor can easily cau"<' problems for Fortran programs l)y expandin!! macro" such that a line is longer than 72 characters. not recognizing Fortran comments. eliminating sonwthing that looks like a C comnwnt. and affecting the compiler· s ability to print the correct line number when issuing a diagnostic.
The C preprocessor is well defined for C but not necessarlly for other languages.

Standard Library
Standard C defines a standard set of liLrar\' fum:tions that must be supported by all conforminf! implementations. The presence of this extensiYe library is an aid to de,eJoping portable prof!ram;;. The library consists of a : '.et  This rich :'.et of functions prm·ides an excellent interface to the underlying C implementation and is another adnmtage of Standard C. The implementation is not required to actually proYide external source files for the standard headers. To improve compile time they can be special binary encoded files or even built into the irHPrnals of the compiler. Fortran-:: prmide,; a limited set of standard imrinsic functions that are primarily mathematical functions. Fortran-77 does prm·ide two ,·erv useful intrinsic functions that Standard C does not: MAX and MIN.

Memory Allocation
Some of tlw mo"t useful lillraiT functions are the dynamic memory support functions declared in the stdlib. h header. The standard functions malloc. calloc. realloc. and free define a portable way to dynamically manage :ipace ao;so-ciated with a system heap. Heap space can be allocated with malloc and calloc, the size of allocated space can be increased or decreased "\\ith realloc, and this space can be given back to the heap manager with free. Standard C pointers are used to reference dynamically allocated memory. In addition to dynamically allocated heap space, Standard C permits variables to be declared with global static, local static, or local stack space. Global variables can be either declared to be externally visible to other compilation units, or strictly local to the containing compilation unit.
Fortran-77 only supports global COMMON blocks and local variables. The Fortran-77 standard does not specify ic local variables are static or stack allocations. However. the SAVE statement allows variables to preserve their value across calls to the same function. The absence of a portable dynamic storage management system is a serious deficiency in Fortran-T?. Often. vendors who provide scientific and numerical library package;.; have to provide awkward interfaces that require the programmer to specify additional argument,; for temporary storage.
The wider variety of storage allocation methods available in Standard C is a definitive advantage.
This makes Standard C more portable and convenient to use for many types of applications.

Additional Considerations
Another advantage that Standard C has over Fortran-77 is the abilitv to directlv communicate with

STANDARD C ENHANCEMENTS
It should be noted that Traditional C (i.e .. C as it exi:=;ted prior to the Al\"SI and ISO standards) was used primarily for ;-;ystems applications. and the language's developmt>nt reflected the needs of ;-;ystems programmers. Because C has grown in popularity. the strengths of the language make it appealing for different types of applications. The C standard has been an aid to portability. There are already many production quality Standard conforming C compilers available for a variety of svstems. There are several enhancements in the C standard that make numerical programming easier. These enhancements are honoring parentheses. defining additional floating-point arithmetic.
defining a standard mathematical library, and defining a set of floating-point characteristics.

Honoring Parentheses
One of the more surprising features of Traditional C is that parentheses are not honored for certain operators. Traditional C compilers may evaluate the following expression: (a + b) + c as any one of the following: The Traditional C compiler is free to reorder the evaluation of orerators that are both commutative and associative even in the presence of parentheses. Although the intent was to permit optimizations. it produces problems when trying to control the amount of relative error accumulating in certain floating-point orerations. Cnlike the mathematical real numbers, floating-point addition is not associatin· because the infinite amount of information contained in a real number can onlv be arproximated in a finite floating-point format.
Thi,;; is demonstrated by the following conuived example. compiled with a Standard C Compiler (SCCJ, and run on a Cray Y-~IP computer.

105
Thus there is a demonstrable need to control the order of evaluation with floating-point arithmetic. The only solution available in Traditional C is to store intermediate results in explicit temporaries (i.e., tmp=a+b). Thus, Traditional C imposes the burden of writing a simple statement such as: in an unnatural and more complicated way with the following explicit temporaries: tmpl = a + b; tmp2 = c + d; x = tmpl + tmp2; A numerical programmer wants to be able to express mathematical concepts and needs to have parentheses honored. The C standard now requires an implementation to honor parentheses. This change was made solely for the purpose of making C more suitable for numerical applications. Fortran has always required parentheses to be honored. and the X3J11 committee that defined the C standard greatly enhanced C's usefulness for numerical programming by placing the same requirement on C implementations.

Floating-point Arithmetic
Another deficiencv of Traditional C is the existence of only one type of floating-point arithmetic. Traditional C required all floating-point operations to be performed in type double. The type float existed only to conserve memory. All operands of type float were converted to type double before any arithmetic was performed. Clearly. the bias in Traditional C was toward integer arithmetic where arithmetic was defined for the four integral types int. unsigned int. long. and unsigned long.
The presence of four types of integer arithmetic is now complemented by three types of floatingpoint arithmetic. The C standard defines three floating-point types: float. double. and long double. The new long double type must be at least as precise and contain at least as much range in the exponent as type daub 1 e. The restriction that all operands of type float be conwrted to type double before any operation is performed has been removed. The implementation may convert floating-point operands to a wider precision if that is desirable, but this conversion is not required. This important change provides a variety of arithmetic types from which to choose.
However, these are not the same rules that are present in Fortran-77. The C standard permits an implementation to map all three floating-point types on the same underlying precision and range. Fortran-77 requires that variables with type DOU-BLE PRECISION occupy twice as much storage as variables with type REAL. The implication is that DOUBLE PRECISION provides greater precision than REAL although the Fortran-77 standard does not explicitly require this behavior. Regardless of what the Fortran-77 standard requires the marketplace demands that all Fortran vendors provide greater precision for DOUBLE PRECISION. It is not clear that all C vendors offer the same support, which again reflects the traditional use of C for systems programming. Finally, Fortran-77 does not allow floating-point operations to be performed in a wider precision.

Standard Mathematical Library
One optimization not permitted in Traditional Cis the ability to recognize standard transcendental functions and perform them inline or through a fast interface. Traditional C allows a programmer to redefine anv function in the librarv. This means 0 0 a programmer is at liberty to define a function named tan and expect all calls to tan to use that function in place of the standard library function.
Actually, a function named tan need not compute a tangent at all, but could, for instance, return a value that represents the color tan. Therefore, there is no way in Traditional C to tell at compile time that a particular function is a standard mathematical function. This can significantly affect performance of the standard mathematical functions (e.g., pow, exp, log. sqrt, etc.).
The C standard actuallv reserves the names of all standard functions. This means that if the function tan is called in the presence of the <math. h> header, the compiler can assume that the standard library function is being called. This allows the implementation to replace calls to standard library functions with inline code or special intrinsic versions with fast entry and exit sequences. Furthermore, the C standard permits functions to be called with "assignment compatible" arguments, which is not allowed in Traditional C. This means pow can, for instance, be called with either of its actual arguments being an integral type. The following statement is required to behave as if the 2 were converted to 2. 0 (in the presence of <math. h>) before the function Iii called. y = pow(x, 2): This permits pow (X, 2) to be evaluated inline and to be treated as x**2 when appropriate.
However, the Standard C rules are not quite as convenient as the Fortran-77 rules from the numerical programming point of view. !\"one of the standard transcendentallibran· functions are defined to return either long do~ble or float values. Additional names, such as tanl and tanf that accept and return value,; with types long double or float. respectively, are resen·ed by the standard for future use. However. this means any usage of these functions in programs is not currently portable. Even if they become portable in a future standard the number of names that must be remembered is inconvenient at best.
Fortran-77 defines a generic intrin,.;ic function TAN that accepts arguments for the types REAL. DOUBLE PRECISION, and COMPLEX. Fortran's rules are more convenient because the generic intrinsic functions are overloaded to accept arguments with different types. Finally Fonran-77 provides an exponentiation operator, while C only provides a library function. There is no analogy to the expression i * *n because Standard C forces the result to have a floating-point result. Thi,; can result in a serious performance penalty for any application that performs a reasonable amount of integer exponentiation. smallest positive X such that X + 1.0 =f. 1.0 There are identical sets of names for type double that begin with DBL instead of FLT and for long double that begin with LDBL. These macro names can be used to

Floating-Point Characteristics
The Fortran-77 standard does not define anv way to portably interrogate for floating-point characteristics. However. the definition of the Standard C floating-point model was taken from the Fortran-90 standard to maintain some commonality across language standards. The addition of the floating-point model to the C standard is a valuable aid to writing portable numerical and scientific applications.

REMAINING NUMERICAL C DEFICIENCIES
Although the C standard contains features that make C more desirable for numerical programming than its predecessors, there are still deficien-C n.:RSLS FORTR:\.\"-?? 107 cies that are severe enough to tilt the scales in favor of Fortran-77 for certain types of applications. The severest deficiencies still present in Standard C are the absence of complex and variable length array types, error reporting through a globally modifiable object (errno ), and performance problems associated with unrestricted aliasing. These important issues are being examined bv committee X3.J11.1 (1\"CEG) and must be resolved in order to make Standard C a viable alternative to Fortran-77 as a numerical language.
The following is a discussion of proposals to extend Standard C that are being considered by committee X3.J11. 1.

Complex Arithmetic
The absence of a predefined complex type in Standard C forces programmers to define their own complex type. The most common way of accomplishing this is through a typedeL similar to the following: typedef struct { double re, im; } complex; Although this allows declarations of objects with a complex type. it inhibits the use of standard infix operators such as: I. *, -. +. Instead functions or macros must he defined to perform these operations. This means that using natural infix expressions such as: is not accommodated. Instead, programmers are forced to write with a functional notation such as: a= CMUL(CADD(b,c), CADD(d,e)); Substituting a functional notation for the elegant infix operators makes the expression harder to decipher. An application requiring extensive use of complex arithmetic is difficult to code in C. Standard C needs a complex type. Fortran has supported a complex type for many years. An application that requires a complex type if probably going to be much easier to develop in Fortran-77 than in Standard C. Adding a new type to a language is difficult to get "right" because of the complexity associated with closure on the language. Committee X3.J11.1 is attempting to define a complex extension to C and has identified a number of issues that must be resolved before this language extension is approved. For instance, an obvious approach to this extension is to add a new keyword. complex, to typedef struct { double re, 1m; } complex; and branding these programs as nonconforming by carelessly adding a new keyword. is unacceptable. The solution is to add a new header complex. h that introduces the new type. Existing programs will not include this header and therefore \\ill not be affected.
Because there are three floating-point types. there should be three corresponding complex types. These types are declared: float complex. double complex. and long double complex. With the addition of complex types in C. new arithmetic conversion rules are needed to define the result type of expressions that contain both real and complex operands. For instance. if one operand has type long double and the other operand has type float complex. the rule,; ,.;lwuld be such that the most information i'i preserved. Therefore. the rules are enhanced to produce a result type of long double complex. The proposed rules are described below.
All types haw three type attributes called the dimension, the formal. and the length. The dimension attribute specifies whether the values of the type can be represented on a one-dimensional line (i.e., real numbers) or on a two-dimensional plane (i.e., complex numbers). The format attribute specifies whether the values of thf' type are represented with an exponent part (i.e .. floating numbers) or without an exponent part (i.e .. integral numbers). The length attribute specifit's how many bits are used to represent the magnitude and precision of the type. The values of each of the language. permitting declarations of complex types. However, too many programs already exist that use: these attributes are ranked, from highest to lowest (Table 1). For example. complex ranks higher than real for the dimension attribute.
.\lany binary operators that have operands of arithmetic types cause implicit conversions of one or both operands. The purpose of the conversions is to yield a common format and length for the two operands and the type of the result. These implicit conversions of the operands are called the usual arithmetic conversions.
The conversions shall preserve the ori¢nal magnitude and precision of both operands except that precision may he lost when an integral type is converted to a floating type. This will occur if the magnitude of the integer is too greater for the mantissa of the floating type to represent exactly. The rules for the usual arithmetic conversions are: This is in addition to sinf, sin, and sinl that are alread\· reserved bv the C standard for float-.
. ing-point numbers. The proliferation of names i:; extreme and again it is apparent that some form of generic intrinsic name is needed.

Variable Length Arrays
Another deficiency that might inhibit the use of C is the absence of variable length arrays. Because arravs must be defined with a constant dimension. there is no wa\· inC to declare an arrm· whose size .
. is dynamic. Function arguments that are arrays are implicitly converted to pointers to the first element before the function is callPd. This pointer can he used to access all of the arrav elements. It is easy to define a function that operates on single dimensioned array,; of any length. However. a problem still exists with multidimensional arrays. For instance. a two-dimensional arrav is converted to be a pointer to an array and the array portion of the type must still contain a constant dimen;;ion. This prevents a simple definition of a function that perform:-; a matrix operation on arhitrarv ~I X !\" matrice,;. Idealh·. Standard C would .
. permit a declaration of a function performing a matrix multiply to look similar to the following: C \"ERSCS FORTRAI\-77 109 I* a = b x c *I void mxm(int n, int m, double a [n1 [m1 , double b [n1 [m1 , double c [n1 [m1 ) ; The size of each array is dynamically determined each time the function is called. Because an arrav is always converted to a point to the first element of the array whenever it is passed as a function argument. the problems seems to exist only for multidimensional arrays. However, the inability to declare a one-dimensional stack arrav that is the same size as a formal parameter suggests that this feature is desirable for all array types that reside on the stack. This would permit: I* . . . *I } to declare both the formal parameter ary and the stack array tmp to be variably dimensioned arrays with the same size. This approach is analogous to the Fortran notion of adjustable and automatic arravs. Committee .'\.:3111.1 is looking at two proposals that ext<>ncl C alon;.r these lines. The first approach is the one described above. A. second approach invoh·es the w;e of descriptors that are capable of representing the address of the array and the size of each dimension. For example: void func (double (*desc) [? 1 [? 1) I* tentative syntax *I declares a parameter desc that is a descriptor with three pieces of information: addre:;s of the bast'. lt>n;.rth of the first dimension. and len;.rth of the second dimension. The type of parameter desc is pointer to adjustable array of adjustahlt> array of double. This descriptor can be used to rPference arra,·,; whose dinwnsion sizes van· at ex-. . ecution time.
Fo11ran-"?"? does not support variable len;.rth stack arravs. It is a ven· common extension to . . most Fortran implementations. howe,·er. One additional advanta~t' available with Fortran-"?"? arrays is the ability to specify both upper and lower hounds for each dimension. C arra\·s art' alwm·s zero based and the length of the dimen-sion is specified (not the bounds:i. Some problems are more naturalh· vie\\·ed a;; non-zero based. For completeness sake it should be noted that there is an existin~ solution to the variable length array problem that is standard conforming. Essentially. this solution inmlves using the library function mall oc to dvnamicallv allocate an arrav . . for (i 0; i < n; i++) for ( j = 0; j < n; j + +)

. .
solution does not extend easily to three or four dimensions. The three-dimensional solution requires an array of pointers each pointing at a twodimensional array of pointers, each pointing at a row of the three-dimensional array. The complexity grows rapidly with each new dimension.

The errno Macro
The errno macro expands into an !value expression that specifies a storage location that the C environment modifies under exceptional conditions. } then the error condition goes undetected because the sqrt function cannot fail. This affects both automatic vectorization and parallelization. This is such a limiting condition that vendors who provide high-performance systems are forced to provide two environments: a strictly conforming environment that supports errno but does not vectorize or parallelize loops containing calls to math functions, and an environment that disassociates errno from the math library. ~lodern supercomputers can often times compute the results faster than the code needed to detect the error and update the memory location designated by errno. Attempting to define error conditions in terms of a globally modifiable object creates many problems including severe performance degradations. Committee X3J11.1 is exploring a new mathematical library definition without the presence of errno.
The Fonran-77 standard wisely chose to say nothing about exceptional conditions. This allows the compiler to optimize statements containing calls to the transcendental functions in a standard conforming way. One of Fortran's greatest asset;;; is its potential for optimization.

C Aliasing
Many numerical programs are computationally intensive and benefit from optimizations. The optimization capability of a vendor's Fortran compiler is often times crucial to pnwiding access to the full capabilities of the hardware from a highlevel language. This is especially true for supercomputer environments where compilers perform automatic vectorization and automatic parallelization. Supercomputer sales are largely based on the performance the system can deliver.
C pointers present problems for optimizing compilers because they introduce hidden aliases. Essentially, whenever an object is modified through a pointer, the compiler must make worst case assumptions if it cannot determine which object is being modified. Parallel processing is one current approach being taken to increase performance of many computationally intensh·e applications. The hidden aliases introduced by C pointers make automatic compile time detection of parallelism an intractable problem. Aliases mu:;t be resolved before a compiler can determine that a loop is safe to parallelize. For instance. it is important to know how the elements of an array are accessed and modified. Consider the following loop: Vectorization results require the orde-r of ac-cesses and modifications to be rearranf!ed. The following reordering allows several array elements to be accessed and modified simultaneouslY. One common parallel optimization technique is to simultaneouslv execute different iterations of a loop on multiple processors. This mean;; the order of references 10 objects occurring in different loop iterations is undefined. The following results are obtained for arrav a bv each method. scalar results: vector results: parallel results: 0, 1, 2, 3, 4 0, 1, 3, 5, 7 indeterminate The scalar re,;;ults are always correct because that is what is dictated bv both the Fortran-77 and C standards. Any parallelization that is performed must preserw the scalar re!'iults. In f!eneral. if an object referenced in a particular iteration of the loop i,; al:so modified in a different iteration of the loop. then automatic \·ectorization and parallelization must somehow preserve the order of the accesses and modilication!'i of that object. Example 5 eontains the easily detectable aliasps a [ i J and a [ i -1;. c\ compiler ean dt'tt>t't thi;; alias at compile time and generate a scalar loop. Hnwen~r. the following example demonstrates that C pointers can introduce hidden aliases that are not detectable at compile time.
3, 4, 5}; 6, 5, 4}; The following output is produced when the program i~ t'Xet'lll!'d in sealar ra~hion. Fortran-77. lwwt•n•r, does not permit aliasing through formal pammete1·s if tht· aetual object is modified. This Hwans that a formal paranwter cannot wfen'nee the snme object refen•nct~d by another formal parameter, nor a global object that is part of a COMMON block. Fortran-77 rules require subroutine argumentEo to behave as if they are eopieJ in when the subroutine is ealled and copied ou1 when 1he subrowine returns cont rolto its caller. BPcause the order in which ari!umenh are copied in aud out if' unspecified . . aliac;e::; produl'f• unpn·dictablt~ results. Fortran-77 is a proven perfornwr that provid.-s reasouable senwutics for exploiting automatic parallelism.
C aliasillf! is not ouly the mo,;t critical remnining deficiency, it is one of the most diflicult to resolve. \lany ideas han:• been proposed that sohe part of the prohlem hut none hm·e provided a p-eneral solution dmt encompa,;ses all poiutt•rs. One promisillf! proposal tltm is currently beintr explon~d by C01Jll11ittee X:3J 11.1 j,.; a llt~W kind of pointer called a n~,;triett'd point.-r. A restrieted pointer f.(iH~ii tbe compilt'r the liberty to assume that the pointer behaves like an array for aliasin~ purposes. That is, because the colllpiler can assume that two differetll anavi" are not ·alim;l:'s with each other. it can also assume that two different restricted pointers are uot aliases.