Diego Novillo wrote:
We have been bouncing ideas for a new mechanism to describe the behavior
of function calls so that optimizers can be more aggressive at call
sites.  Currently, GCC supports the notion of pure/impure,
const/non-const, but that is not enough for various cases.

Fortran supports to mark function arguments as INTENT(IN), i.e. they are not modified by the function, or INTENT(OUT), i.e. the variable is set in the function - thus an assignment of a variable just before the function call can be optimized away. (Especially, supporting INTENT(IN) would be useful as by default all variables get passed by reference in Fortran. See PR 23169.

Tobias

PS: Fortran has also the notion of PURE functions. And all objects which are passed by reference or are ALLOCATABLE match C's restricted pointer, unless they have the (pointer) TARGET or the POINTER attribute - only then the same memory can be reached via more than one variable name.

Reply via email to