https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69360

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Apr 22, 2021 at 10:20:54PM +0000, johnnorthall263 at gmail dot com
wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69360
> 
> --- Comment #6 from John Northall <johnnorthall263 at gmail dot com> ---
> It's deliberate!  I think with this level of understanding of fortran use
> in the real world commercial compilers have a bright future!

I'm commercial compiler do have bright future.  Of course, with 
commercial compiler and a license with paid user support, a 
commercial vendor will gladly deal with garbage-in code. 

> If it works with dimension set to 2 (whatever the background
> true value) then it must be easy to make it do so with
> dimension 1?

>From the Fortran 2018 standard,

R873 common-stmt  is COMMON
       [ / [ common-block-name ] / ] common-block-object-list

R874 common-block-object  is variable-name [ ( array-spec ) ]

C8117 (R874) An array-spec in a common-block-object shall be
      an explicit-shape-spec-list.

R816 explicit-shape-spec  is [ lower-bound : ] upper-bound

This is nearly identical to the language in the Fortran 95 standard. 

This statement in setmid.f

      COMMON /SPACE/ XY(1),XYM(1)

is telling gfortran that the array has an upper bound of 1.  Changing
the above statement to have XY(2), XYM(2) does not mean it works.  It
means you got luck with processor defined behavior.  You simply get
a different error message if you ask your Fortran compiler to help
you debug your code.

% ./example1
At line 21 of file setmid.f
Fortran runtime error: Index '155' of dimension 1 of array 'xym' above upper
bound of 2

As to "it must be easy to make it do so with dimension 1", you 
forgot to attach your patch.  gfortran isn't a commercial compiler.
It depends on contributions for volunteers such as yourself,

Reply via email to