public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: W Spector <w6ws@earthlink.net>
To: gfortran <fortran@gcc.gnu.org>
Subject: Re: [patch, fortran] Warn about out-of-bounds access with DO subscripts
Date: Wed, 27 Sep 2017 18:44:00 -0000	[thread overview]
Message-ID: <44d5baa3-f33c-e140-a819-937e10f7f06a@earthlink.net> (raw)

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

             reply	other threads:[~2017-09-27 18:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 18:44 W Spector [this message]
2017-09-28 17:38 ` Thomas Koenig
  -- 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=44d5baa3-f33c-e140-a819-937e10f7f06a@earthlink.net \
    --to=w6ws@earthlink.net \
    --cc=fortran@gcc.gnu.org \
    /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).