(j3.2006) parameterized derived types

Robert Corbett robert.corbett
Tue Dec 8 03:52:40 EST 2015


Constraints placed on components of derived types appear to be intended to 
ensure that the values of expressions that appear in derived type definitions 
shall not depend on any nonconstant values other than the values of the type 
parameters.  One way in which the constraints fail to do so is that the 
expressions can include floating-point operations whose value depend on the 
rounding mode.  The rounding mode might be considered a hidden variable, but the 
standard does not say that.  Does any implementation of parameterized derived 
types take the possibility of changing rounding modes into account?

I considered changing the rounding mode to the processor-dependent initial 
rounding mode during elaboration of a type specifier with parameters, but the 
standard does not appear to allow that.

Ensuring that floating-point expressions produce the same values under a single 
rounding mode is difficult but possible given the backends I need to support.  
By default, the optimizers reorder floating-point expressions to produce more 
efficient code.  Forcing them not to do so requires giving up many optimization 
that are harmless.  The x87 environments are particularly difficult to handle.

Bob Corbett



More information about the J3 mailing list