public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59065] questionable bounds for unassociated allocatable/pointer arrays?
Date: Mon, 11 Nov 2013 19:10:00 -0000	[thread overview]
Message-ID: <bug-59065-4-eTbgZ0nw4B@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59065-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59065

Harald Anlauf <anlauf at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gmx dot de

--- Comment #6 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Vittorio Zecca from comment #5)
> I do not think SIZE should be used to detect an undefined array
> pointer, but a size of zero
> warns the code that the array is mostly unusable and that perhaps
> something is wrong,
> while a nonzero size is telling the program it is fine to use the array.

No.  As Steve pointed out in comment #3, a zero sized array is perfectly fine.
IMO that was a good choice in Fortran, so one does not have to special-case
these when writing code.  Your opinion may differ.

Please also have a look at the Fortran standard, e.g.

13.7.156 SIZE (ARRAY [, DIM, KIND])
Description. Size of an array or one extent.
Class. Inquiry function.
Arguments.
ARRAY        shall be an array of any type. It shall not be an unallocated
allocatable variable or a pointer that
              is not associated. ...

> I agree with Dominique, I am still writing invalid code all the time,
> also because interactive
> computing makes it so easy and fast to write, compile, link and execute code.
> When I used punched cards in the seventies I had more time to think
> and reflect about my
> programs, also because the turnaround time was about 30 minutes as compared
> with 30 seconds today
> If the programmers did not write invalid code many people would be out
> of business:-)

Or they would be more productive...


  parent reply	other threads:[~2013-11-11 19:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-10 10:29 [Bug fortran/59065] New: " zeccav at gmail dot com
2013-11-10 16:44 ` [Bug fortran/59065] " kargl at gcc dot gnu.org
2013-11-10 19:46 ` zeccav at gmail dot com
2013-11-10 19:57 ` sgk at troutmask dot apl.washington.edu
2013-11-10 20:36 ` dominiq at lps dot ens.fr
2013-11-11  9:14 ` zeccav at gmail dot com
2013-11-11 19:10 ` anlauf at gmx dot de [this message]
2013-11-12  8:13 ` zeccav at gmail dot com
2013-11-12 14:20 ` sgk at troutmask dot apl.washington.edu
2013-11-12 15:52 ` zeccav at gmail dot com
2021-02-21  7:43 ` zeccav at gmail dot com
2021-02-21  9:41 ` dominiq at lps dot ens.fr

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=bug-59065-4-eTbgZ0nw4B@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).