[PATCH][4.3] Deprecate -ftrapv

Toon Moene toon@moene.indiv.nluug.nl
Thu Mar 6 20:59:00 GMT 2008


Robert Dewar wrote:
> FX Coudert wrote:
>>>> In Fortran, integers are used to index arrays.  So if you want  
>>>> integer overflow checking, use -fbounds-check :-)
>>> I know there is a smiley here, but it seems to me that range checking
>>> is quite different from overflow checking.
>>
>> I think what Toon was alluding to is that "real" Fortran programmers  
>> don't use integers except for array subscripts. Real life is floating- 
>> point based!
> 
> Well as a one-time real Fortran programmer i would say that comes
> under the rubric of common misconception. Sure there are lots of
> fpt operations in Fortran code, but probably most Fortran programs
> have more integer arithmetic operations than fpt operations, and
> by no means all are about array indexing :-)
> 
> I can't remember if Knuth's empirical study of actual Fortran
> code commented on this situation (that was the study that showed
> that the average expression in Fortran has only a few terms,
> unfortunately it is not available unless you pay $30 :-) on the web.

Well, the solution of the question: "Does Fortran require the catching 
of signed integer overflow" certainly needs the resolution of the 
question: Does Fortran (the language) require to specify the extent of 
integers.

Well, it doesn't (it is a implementation quality issue).  So the issue 
really becomes: when is integer overflow a quality of implementation 
issue ?  If you can't index arrays with them - therefore, my remark.

-- 
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.indiv.nluug.nl/~toon/
Progress of GNU Fortran: http://gcc.gnu.org/ml/gcc/2008-01/msg00009.html



More information about the Gcc mailing list