This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix libgomp Fortran tests


Jerry DeLisle wrote:
If gfortran were to support asymmetrical integers then the ABS intrinsic should throw a runtime error on ABS(most_negative_value). It does not follow common sense or good reasoning to have an incorrect result and to do so knowingly.

To avoid the runtime penalty in computations of checking for that absurd case, I think its better to just not allow it and stick with the standard which defines symmetrical integers.

But, if you restrict the set of permitted integer values to a symmetric set, then by that same logic (and application of 7.1.7, "The execution of any numeric operation whose result is not defined by the arithmetic used by the processor is prohibited."), the subtraction operator should throw a runtime error on HUGE(I)-1.


Doing that would, of course, require an explicit runtime check on every addition and subtraction, and thus would incur a substantial runtime penalty.

As a result, restricting the set of integers to a symmetric set is not only an annoyance for users, it also _does not solve the problem_. It merely shifts it to the addition operators rather than the ABS() intrinsic.

Luckily, neither 7.1.7 nor 13.14 (which has the corresponding restriction for intrinsic procedure calls) actually requires that these sorts of errors be diagnosed either at compile time or at runtime.

- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]