public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files
       [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
@ 2021-04-16 21:17 ` pinskia at gcc dot gnu.org
  2021-04-16 22:36 ` johnnorthall263 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-16 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johnnorthall263 at gmail dot com

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 100123 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files
       [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
  2021-04-16 21:17 ` [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files pinskia at gcc dot gnu.org
@ 2021-04-16 22:36 ` johnnorthall263 at gmail dot com
  2021-04-17  1:07 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: johnnorthall263 at gmail dot com @ 2021-04-16 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from John Northall <johnnorthall263 at gmail dot com> ---
O dear - that makes gfortran unusable on many existing codes - not really
satisfactory is it?
John

On Fri, Apr 16, 2021 at 11:08 PM pinskia at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69360
>
> Andrew Pinski <pinskia at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |johnnorthall263 at gmail
> dot com
>
> --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> *** Bug 100123 has been marked as a duplicate of this bug. ***
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files
       [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
  2021-04-16 21:17 ` [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files pinskia at gcc dot gnu.org
  2021-04-16 22:36 ` johnnorthall263 at gmail dot com
@ 2021-04-17  1:07 ` kargl at gcc dot gnu.org
  2021-04-22 22:20 ` johnnorthall263 at gmail dot com
  2021-04-23  1:32 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-04-17  1:07 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to John Northall from comment #4)
> O dear - that makes gfortran unusable on many existing codes - not really
> satisfactory is it?
> John
> 


gfortran is fairly good at finding bugs in a user's program if
one asks gfortran to do so.  Add -fcheck=all to your options.

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

Now, you have an opportunity to fix your code.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files
       [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-04-17  1:07 ` kargl at gcc dot gnu.org
@ 2021-04-22 22:20 ` johnnorthall263 at gmail dot com
  2021-04-23  1:32 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 5+ messages in thread
From: johnnorthall263 at gmail dot com @ 2021-04-22 22:20 UTC (permalink / raw)
  To: gcc-bugs

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!  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?
Cheers, John

On Sat, Apr 17, 2021 at 2:48 AM kargl at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69360
>
> kargl at gcc dot gnu.org changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |kargl at gcc dot gnu.org
>
> --- Comment #5 from kargl at gcc dot gnu.org ---
> (In reply to John Northall from comment #4)
> > O dear - that makes gfortran unusable on many existing codes - not really
> > satisfactory is it?
> > John
> >
>
>
> gfortran is fairly good at finding bugs in a user's program if
> one asks gfortran to do so.  Add -fcheck=all to your options.
>
> At line 21 of file setmid.f
> Fortran runtime error: Index '155' of dimension 1 of array 'xym' above
> upper
> bound of 1
>
> Now, you have an opportunity to fix your code.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files
       [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-04-22 22:20 ` johnnorthall263 at gmail dot com
@ 2021-04-23  1:32 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 5+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-04-23  1:32 UTC (permalink / raw)
  To: gcc-bugs

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,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-23  1:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-69360-4@http.gcc.gnu.org/bugzilla/>
2021-04-16 21:17 ` [Bug fortran/69360] loop optimization produces invalid code when a common array has dimension 1 in some files pinskia at gcc dot gnu.org
2021-04-16 22:36 ` johnnorthall263 at gmail dot com
2021-04-17  1:07 ` kargl at gcc dot gnu.org
2021-04-22 22:20 ` johnnorthall263 at gmail dot com
2021-04-23  1:32 ` sgk at troutmask dot apl.washington.edu

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