public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115348] New: -fcheck=recursion issue with intent(out) derived type argument without components with default value
@ 2024-06-04 20:38 maxime.vandenbossche at kuleuven dot be
  2024-06-06 18:24 ` [Bug fortran/115348] " jeffrey.armstrong at approximatrix dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: maxime.vandenbossche at kuleuven dot be @ 2024-06-04 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115348
           Summary: -fcheck=recursion issue with intent(out) derived type
                    argument without components with default value
           Product: gcc
           Version: 13.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maxime.vandenbossche at kuleuven dot be
  Target Milestone: ---

Created attachment 58347
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58347&action=edit
Reproducer

With gfortran >= v13.3.0 (on x86-64), the attached example fails to compile
when runtime checks for recursion are included, e.g.:

~$ gfortran -fcheck=recursion test.f90
/usr/bin/ld: /tmp/ccG76pT1.o: warning: relocation against `is_recursive.0.2' in
read-only section `.text'
/usr/bin/ld: /tmp/ccG76pT1.o: in function `__mymodule_MOD_myroutine':
test.f90:(.text+0x37): undefined reference to `is_recursive.0.2'
/usr/bin/ld: test.f90:(.text+0x5f): undefined reference to `is_recursive.0.2'
/usr/bin/ld: test.f90:(.text+0xe5): undefined reference to `is_recursive.0.2'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

The issue dissapears when e.g. changing the intent of the "self" argument of
the "myroutine" procedure from "out" to "inout". The issue also dissapears when
giving a default value to the "mynumber" component of the "mytype" derived type
(e.g. "integer :: mynumber = 0") or when adding another component with a
default value (e.g. "integer :: mysecondnumber = 0").

But I would assume that also the unmodified example is valid code. If that
turns out not to be the case, then I'd still wish for a slightly more
descriptive error message :).

The example works fine with gfortran <= v13.2. Godbolt suggests the issue, if
confirmed, is also present in the nightly trunk build.

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

* [Bug fortran/115348] -fcheck=recursion issue with intent(out) derived type argument without components with default value
  2024-06-04 20:38 [Bug fortran/115348] New: -fcheck=recursion issue with intent(out) derived type argument without components with default value maxime.vandenbossche at kuleuven dot be
@ 2024-06-06 18:24 ` jeffrey.armstrong at approximatrix dot com
  2024-06-08 20:24 ` [Bug fortran/115348] [13/14/15 Regression] " anlauf at gcc dot gnu.org
  2024-06-09  6:24 ` pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jeffrey.armstrong at approximatrix dot com @ 2024-06-06 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey Armstrong <jeffrey.armstrong at approximatrix dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jeffrey.armstrong@approxima
                   |                            |trix.com

--- Comment #1 from Jeffrey Armstrong <jeffrey.armstrong at approximatrix dot com> ---
I'm also seeing this bug on x86_64-w64-mingw32 GCC 14.1.0 in a project when
built with -fcheck=all and procedures with "intent(out)" arguments.

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

* [Bug fortran/115348] [13/14/15 Regression] -fcheck=recursion issue with intent(out) derived type argument without components with default value
  2024-06-04 20:38 [Bug fortran/115348] New: -fcheck=recursion issue with intent(out) derived type argument without components with default value maxime.vandenbossche at kuleuven dot be
  2024-06-06 18:24 ` [Bug fortran/115348] " jeffrey.armstrong at approximatrix dot com
@ 2024-06-08 20:24 ` anlauf at gcc dot gnu.org
  2024-06-09  6:24 ` pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-06-08 20:24 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |15.0
           Priority|P3                          |P4
            Summary|-fcheck=recursion issue     |[13/14/15 Regression]
                   |with intent(out) derived    |-fcheck=recursion issue
                   |type argument without       |with intent(out) derived
                   |components with default     |type argument without
                   |value                       |components with default
                   |                            |value
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-08

--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.

Workarounds:

- add "recursive" attribute to subroutine myroutine
- add a default initialization to component mynumber

Might be related to pr115070.

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

* [Bug fortran/115348] [13/14/15 Regression] -fcheck=recursion issue with intent(out) derived type argument without components with default value
  2024-06-04 20:38 [Bug fortran/115348] New: -fcheck=recursion issue with intent(out) derived type argument without components with default value maxime.vandenbossche at kuleuven dot be
  2024-06-06 18:24 ` [Bug fortran/115348] " jeffrey.armstrong at approximatrix dot com
  2024-06-08 20:24 ` [Bug fortran/115348] [13/14/15 Regression] " anlauf at gcc dot gnu.org
@ 2024-06-09  6:24 ` pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pault at gcc dot gnu.org @ 2024-06-09  6:24 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org
                 CC|                            |pault at gcc dot gnu.org

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
This is indeed related to PR115070. As soon as I am done with PR59104, I will
submit a patch. A fix exists but looks rather inelegant. I will endeavour to
improve it. In the mean time, please use one of Harald's suggested workarounds.

Thanks for the report.

Paul

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

end of thread, other threads:[~2024-06-09  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 20:38 [Bug fortran/115348] New: -fcheck=recursion issue with intent(out) derived type argument without components with default value maxime.vandenbossche at kuleuven dot be
2024-06-06 18:24 ` [Bug fortran/115348] " jeffrey.armstrong at approximatrix dot com
2024-06-08 20:24 ` [Bug fortran/115348] [13/14/15 Regression] " anlauf at gcc dot gnu.org
2024-06-09  6:24 ` pault 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).