public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105503] New: vptr and data are uninitialised error for intent(out) argument of abstract type
@ 2022-05-06  8:33 mscfd at gmx dot net
  2022-05-06  9:31 ` [Bug fortran/105503] " mscfd at gmx dot net
  0 siblings, 1 reply; 2+ messages in thread
From: mscfd at gmx dot net @ 2022-05-06  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105503
           Summary: vptr and data are uninitialised error for intent(out)
                    argument of abstract type
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mscfd at gmx dot net
  Target Milestone: ---

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

The attached module, compiled with

gfortran-12 -Wall uninit_vptr.f90 -c

gives

uninit_vptr.f90:34:19:

   34 |       call f%sub(x)
      |                   ^
Warning: ‘x._data’ is used uninitialized [-Wuninitialized]
uninit_vptr.f90:33:42:

   33 |       class(a), dimension(:), pointer :: x
      |                                          ^
note: ‘x’ declared here
uninit_vptr.f90:34:19:

   34 |       call f%sub(x)
      |                   ^
Warning: ‘x._vptr’ is used uninitialized [-Wuninitialized]
uninit_vptr.f90:33:42:

   33 |       class(a), dimension(:), pointer :: x
      |                                          ^
note: ‘x’ declared here

But argument x has the intent(out) attribute and the warning seems bogus. (The
original code, where this occured, is an implementation of the abstract factory
design pattern.)

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

* [Bug fortran/105503] vptr and data are uninitialised error for intent(out) argument of abstract type
  2022-05-06  8:33 [Bug fortran/105503] New: vptr and data are uninitialised error for intent(out) argument of abstract type mscfd at gmx dot net
@ 2022-05-06  9:31 ` mscfd at gmx dot net
  0 siblings, 0 replies; 2+ messages in thread
From: mscfd at gmx dot net @ 2022-05-06  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from martin <mscfd at gmx dot net> ---
Created attachment 52934
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52934&action=edit
reduced uninit_vptr

Testcase further reduced.

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

end of thread, other threads:[~2022-05-06  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  8:33 [Bug fortran/105503] New: vptr and data are uninitialised error for intent(out) argument of abstract type mscfd at gmx dot net
2022-05-06  9:31 ` [Bug fortran/105503] " mscfd at gmx dot net

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