public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
@ 2020-04-19 15:46 innspg at yahoo dot fr
  2020-04-19 16:55 ` [Bug fortran/94660] " innspg at yahoo dot fr
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: innspg at yahoo dot fr @ 2020-04-19 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94660
           Summary: Wrong subroutine called at runtime than the one called
                    in the source code with deferred subroutines
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: innspg at yahoo dot fr
  Target Milestone: ---

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

* [Bug fortran/94660] Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
  2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
@ 2020-04-19 16:55 ` innspg at yahoo dot fr
  2020-04-19 16:56 ` innspg at yahoo dot fr
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: innspg at yahoo dot fr @ 2020-04-19 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

innspg at yahoo dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |innspg at yahoo dot fr

--- Comment #1 from innspg at yahoo dot fr ---
Created attachment 48306
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48306&action=edit
tar files of fortran Source files that reproduce the bug

The attachment is a tar file containing 4 fortran sources codes to reproduce
the bug.

gfortran 4.8.5 produces the expected result
All other versions that I tried produced the wrong results; those versions are:
6.3.0, 7.3.0, 7.5.0, 8.2.0, 8.4.0 and 9.2.0.


The expected output when the program is ran should be:

Test: calling C%init
  B::init, calling setup
    C::setup
  B::init done ...............
Test: calling C%finalize
  B::finalize, calling free_resources
    C::free_resources
  B::finalize, calling cleanup
  B::cleanup
  B::finalize done ...................
Test:done.......................

I am getting this instead:

Test: calling C%init
  B::init, calling setup
  B::cleanup
  B::init done ...............
Test: calling C%finalize
  B::finalize, calling free_resources
    C::setup
  B::finalize, calling cleanup
  B::cleanup
  B::finalize done ...................
Test:done.......................

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

* [Bug fortran/94660] Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
  2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
  2020-04-19 16:55 ` [Bug fortran/94660] " innspg at yahoo dot fr
@ 2020-04-19 16:56 ` innspg at yahoo dot fr
  2020-04-19 18:38 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: innspg at yahoo dot fr @ 2020-04-19 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from innspg at yahoo dot fr ---
The bug was reproduced with the following version of gfortran: 6.3.0, 7.3.0,
7.5.0, 8.2.0, 8.4.0 and 9.2.0.

gfortran 4.8.5 produces the expected result


The expected output when the program is ran should be:

Test: calling C%init
  B::init, calling setup
    C::setup
  B::init done ...............
Test: calling C%finalize
  B::finalize, calling free_resources
    C::free_resources
  B::finalize, calling cleanup
  B::cleanup
  B::finalize done ...................
Test:done.......................

I am getting this instead:

Test: calling C%init
  B::init, calling setup
  B::cleanup
  B::init done ...............
Test: calling C%finalize
  B::finalize, calling free_resources
    C::setup
  B::finalize, calling cleanup
  B::cleanup
  B::finalize done ...................
Test:done.......................

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

* [Bug fortran/94660] Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
  2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
  2020-04-19 16:55 ` [Bug fortran/94660] " innspg at yahoo dot fr
  2020-04-19 16:56 ` innspg at yahoo dot fr
@ 2020-04-19 18:38 ` kargl at gcc dot gnu.org
  2021-01-25 19:41 ` tkoenig at gcc dot gnu.org
  2023-12-05 19:02 ` gnu.gcc.detection675 at passmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-04-19 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-19
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.8.5
     Ever confirmed|0                           |1
      Known to fail|                            |6.3.0, 7.3.0, 7.5.0, 8.2.0,
                   |                            |8.4.0, 9.2.0

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

* [Bug fortran/94660] Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
  2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
                   ` (2 preceding siblings ...)
  2020-04-19 18:38 ` kargl at gcc dot gnu.org
@ 2021-01-25 19:41 ` tkoenig at gcc dot gnu.org
  2023-12-05 19:02 ` gnu.gcc.detection675 at passmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-01-25 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I just ran this through nagfor, and it agrees with gfortran.
Nagfor is usually quite picky.

xlf, on the other hand, agrees with you, so it does not seem
to be straightforward, at least.

This will take some further analysis.

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

* [Bug fortran/94660] Wrong subroutine called at runtime than the one called in the source code with deferred subroutines
  2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
                   ` (3 preceding siblings ...)
  2021-01-25 19:41 ` tkoenig at gcc dot gnu.org
@ 2023-12-05 19:02 ` gnu.gcc.detection675 at passmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: gnu.gcc.detection675 at passmail dot com @ 2023-12-05 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jeff Hole <gnu.gcc.detection675 at passmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnu.gcc.detection675@passma
                   |                            |il.com

--- Comment #4 from Jeff Hole <gnu.gcc.detection675 at passmail dot com> ---
Created attachment 56807
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56807&action=edit
clue: combining modules into a single file gives expected results

Here's an interesting clue: the correct results occur when all the modules are
stored in the same source file (note, all modules are still separate, just in
the same file).

This is certainly not a solution, but it does provide a clue to the problem, as
well as and a way to get things working the way you want. Ultimately, it is
necessary that this works across separate module source files so that we
separate compilation steps and enable extensions of these types beyond the
single source file.

I compiled with gfortran:
    GNU Fortran (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)

I attached tarball "buginnspg-clue.tar".

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

end of thread, other threads:[~2023-12-05 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 15:46 [Bug fortran/94660] New: Wrong subroutine called at runtime than the one called in the source code with deferred subroutines innspg at yahoo dot fr
2020-04-19 16:55 ` [Bug fortran/94660] " innspg at yahoo dot fr
2020-04-19 16:56 ` innspg at yahoo dot fr
2020-04-19 18:38 ` kargl at gcc dot gnu.org
2021-01-25 19:41 ` tkoenig at gcc dot gnu.org
2023-12-05 19:02 ` gnu.gcc.detection675 at passmail dot com

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