From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Wed Jan 16 23:34:11 2013
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 22E76356C84; Wed, 16 Jan 2013 23:34:11 +0100 (CET)
Delivered-To: sc22wg5@open-std.org
Received: from ppsw-43.csi.cam.ac.uk (ppsw-43.csi.cam.ac.uk [131.111.8.143])
	by www.open-std.org (Postfix) with ESMTP id 3D7B0356944
	for <sc22wg5@open-std.org>; Wed, 16 Jan 2013 23:34:09 +0100 (CET)
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: not scanned
X-Cam-ScannerInfo: http://www.ucs.cam.ac.uk/email/scanner/
Received: from hermes-1.csi.cam.ac.uk ([131.111.8.51]:45542)
	by ppsw-43.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:25)
	with esmtpa (EXTERNAL:nmm1) id 1TvZhw-00039F-nA (Exim 4.72)
	(return-path <nmm1@hermes.cam.ac.uk>); Wed, 16 Jan 2013 20:35:36 +0000
Received: from prayer by hermes-1.csi.cam.ac.uk (hermes.cam.ac.uk)
	with local (PRAYER:nmm1) id 1TvZhw-0001lf-74 (Exim 4.72)
	(return-path <nmm1@hermes.cam.ac.uk>); Wed, 16 Jan 2013 20:35:36 +0000
Received: from [87.114.176.251] by webmail.hermes.cam.ac.uk
	with HTTP (Prayer-1.3.5); 16 Jan 2013 20:35:36 +0000
Date: 16 Jan 2013 20:35:36 +0000
From: "N.M. Maclaren" <nmm1@cam.ac.uk>
To: longb@cray.com
Cc: sc22wg5 <sc22wg5@open-std.org>
Subject: Re: [ukfortran] (SC22WG5.4899) (j3.2006) Comment on a comment on the
 WG5 letterballot on N1947
Message-ID: <Prayer.1.3.5.1301162035360.32451@hermes-1.csi.cam.ac.uk>
In-Reply-To: <20130116191114.A6A75356A2B@www.open-std.org>
References: <20130108205438.50F4E356B56@www.open-std.org>
 <20130113210632.B1C67356BEA@www.open-std.org>
 <20130116050422.92E30356BE0@www.open-std.org>
 <20130116191114.A6A75356A2B@www.open-std.org>
X-Mailer: Prayer v1.3.5
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset=ISO-8859-1
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Jan 16 2013, Bill Long wrote:
>
>In recent memory, I've only encountered one case of harmful integer 
>overflow, and that occurred in converting a large real value to integer 
>and was caught by the IEEE hardware traps.  Of course, there are 
>numerous cases, almost all related to user-written random number 
>generators, where overflow of integer multiply is intentional.  For 
>those cases, enabling a check would cause the program to stop working.

Do none of the codes you see ever include fragments like the following?

    SUBROUTINE weeble (arg)
    REAL(KIND=KIND(0.0D0)) :: arg(:,:)
    REAL(KIND=KIND(0.0D0)) :: scratch(UBOUND(arg,1)*(UBOUND(arg,1)+1)/2)

Being caught out by default integers being large enough for any single
dimension but not the total size of an array, and accidentally using a
calculation that creates the latter, is a very common mistake in all of
Fortran, C and C++.


Regards,
Nick Maclaren.

