public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/113128] New: Wrong implied-do with optimizations
@ 2023-12-24 17:06 gigor-ads at yandex dot ru
  2023-12-24 20:41 ` [Bug fortran/113128] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gigor-ads at yandex dot ru @ 2023-12-24 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113128
           Summary: Wrong implied-do with optimizations
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gigor-ads at yandex dot ru
  Target Milestone: ---

Hello!

With the following small example (called test.f90):
program main
  implicit none
  integer, parameter :: nal = 5, nbe = 4
  real(8) :: v(nal,nal,nbe,nbe)
  integer :: i,j,k,l
  open(16,file='ijklab',form='unformatted')
  write(16) ((((v(i,k,j,l),i=1,merge(k,nal,l==j)),j=1,l),k=1,nal),l=1,nbe)
  close(16)
end program main

With different level of optimizations, one can get file 'ijklab' with different
sizes.

With -O0:
gfortran -O0 test.f90 -o test.O0 && ./test.O0 && ls -la

-rw-rw-r-- 1 user group  1688 Dec 24 18:02 ijklab

With -O1:
gfortran -O1 test.f90 -o test.O1 && ./test.O1 && ls -la

-rw-rw-r-- 1 user group  2008 Dec 24 18:04 ijklab

Tested version:
$ gfortran --version
GNU Fortran (GCC) 12.2.0 20220819 (HPE)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1688 bytes is a correct answer.

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

* [Bug fortran/113128] Wrong implied-do with optimizations
  2023-12-24 17:06 [Bug fortran/113128] New: Wrong implied-do with optimizations gigor-ads at yandex dot ru
@ 2023-12-24 20:41 ` kargl at gcc dot gnu.org
  2023-12-24 22:19 ` gigor-ads at yandex dot ru
  2023-12-24 22:23 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-12-24 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-12-24
      Known to fail|                            |12.2.0
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |14.0
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
Works with top-of-tree.

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

* [Bug fortran/113128] Wrong implied-do with optimizations
  2023-12-24 17:06 [Bug fortran/113128] New: Wrong implied-do with optimizations gigor-ads at yandex dot ru
  2023-12-24 20:41 ` [Bug fortran/113128] " kargl at gcc dot gnu.org
@ 2023-12-24 22:19 ` gigor-ads at yandex dot ru
  2023-12-24 22:23 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gigor-ads at yandex dot ru @ 2023-12-24 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

Igor S Gerasimov <gigor-ads at yandex dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Igor S Gerasimov <gigor-ads at yandex dot ru> ---
Oh! Thank you!

I found commit:
https://github.com/gcc-mirror/gcc/commit/5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2

Very close to my own patch :D

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

* [Bug fortran/113128] Wrong implied-do with optimizations
  2023-12-24 17:06 [Bug fortran/113128] New: Wrong implied-do with optimizations gigor-ads at yandex dot ru
  2023-12-24 20:41 ` [Bug fortran/113128] " kargl at gcc dot gnu.org
  2023-12-24 22:19 ` gigor-ads at yandex dot ru
@ 2023-12-24 22:23 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-24 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 111837 ***

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

end of thread, other threads:[~2023-12-24 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-24 17:06 [Bug fortran/113128] New: Wrong implied-do with optimizations gigor-ads at yandex dot ru
2023-12-24 20:41 ` [Bug fortran/113128] " kargl at gcc dot gnu.org
2023-12-24 22:19 ` gigor-ads at yandex dot ru
2023-12-24 22:23 ` pinskia at gcc dot gnu.org

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