To: J3 J3/18-151 From: Robert Corbett Subject: A VIRTUOUS or SUPER_PURE attribute for functions Date: 2018-February-15 References: 18-122r1 Introduction ------------ A procedure with the PURE attribute is allowed to read the values of data entities that are not accessed through dummy arguments and are not local to the procedure. The feature requested in 18-122r1 is for a stronger attribute that includes all of the restrictions on pure procedures and also prohibits access to data entities that might have varying values and that are external to the procedure. The rationale for adding the new attribute in 18-122r1 is to allow a user to create functions that the processor can move without regard to context. This capability might allow processors to perform optimizations that would not be allowed for pure procedures. Note that floating-point operations might depend on global rounding modes and trap mode settings. Performing a floating-point operation might set an exeception flags. Therefore, when a processor invokes a super-pure function that performs floating-point oprations, it must reset the floating-point rounding mode and the trap modes on entry and must restore the exception flags on exit. The name of the new attribute is not yet set in concrete.