From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78346 invoked by alias); 27 Sep 2017 18:44:20 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 78055 invoked by uid 89); 27 Sep 2017 18:44:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBLACK,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD,SPF_PASS autolearn=no version=3.3.2 spammy=Obviously, walter, H*F:D*earthlink.net X-HELO: elasmtp-dupuy.atl.sa.earthlink.net Received: from elasmtp-dupuy.atl.sa.earthlink.net (HELO elasmtp-dupuy.atl.sa.earthlink.net) (209.86.89.62) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Sep 2017 18:44:18 +0000 Received: from [99.66.144.144] (helo=[192.168.1.192]) by elasmtp-dupuy.atl.sa.earthlink.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4) (envelope-from ) id 1dxHJf-0005SO-Uu for fortran@gcc.gnu.org; Wed, 27 Sep 2017 14:44:16 -0400 From: W Spector Subject: Re: [patch, fortran] Warn about out-of-bounds access with DO subscripts To: gfortran Message-ID: <44d5baa3-f33c-e140-a819-937e10f7f06a@earthlink.net> Date: Wed, 27 Sep 2017 18:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: bd16f1146586632f4d2b10475b571120ab81f91296c221d43aac166cce4c3411841f81fa394cfcdf350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-SW-Source: 2017-09/txt/msg00123.txt.bz2 Thomas, This is a nice warning - thank you for adding it. FWIW - in ancient pre-Fortran 77 code it was common for an array dummy argument to have a size of '1', then over-indexed, because the '*' for assumed size arrays was not yet standardized. E.g. code like: SUBROUTINE SUB (A, B) REAL A(1), B(42,1) should almost always be written: SUBROUTINE SUB (A, B) REAL A(*), B(42,*) I imagine a few folks blowing the dust off some very old code may be surprised to start getting these warnings. Obviously their code should have been changed to use '*' 30+ years ago... Walter