public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: W Spector <w6ws@earthlink.net>, gfortran <fortran@gcc.gnu.org>
Subject: Re: [patch, fortran] Warn about out-of-bounds access with DO subscripts
Date: Thu, 28 Sep 2017 17:38:00 -0000	[thread overview]
Message-ID: <0d3c9e83-34ea-810f-e810-96634c717f02@netcologne.de> (raw)
In-Reply-To: <44d5baa3-f33c-e140-a819-937e10f7f06a@earthlink.net>

Hi Walter,

> This is a nice warning - thank you for adding it.

Thanks!

> 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...

If it gives people an incentive to modernize, so much the better.
Using '1' as trailing subscript is also caught with bounds checking
with gfortran, so these people could also not have used that.
We'll see if large numbers of people suddenly start complaining,
but I don't think so :-)

Regards

	Thomas

  reply	other threads:[~2017-09-28 17:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 18:44 W Spector
2017-09-28 17:38 ` Thomas Koenig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-23 12:33 Thomas Koenig
2017-09-25  2:30 ` Jerry DeLisle
2017-09-25 16:50   ` Thomas Koenig
2017-09-26  7:17     ` Thomas Schwinge
2017-09-26 11:47       ` Jakub Jelinek
2017-09-26 16:53         ` Thomas Koenig
2017-09-26 16:52       ` Thomas Koenig
2017-09-27  8:37         ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d3c9e83-34ea-810f-e810-96634c717f02@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=w6ws@earthlink.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).