public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100478] New: Type Pointer Segfaults
@ 2021-05-07 21:26 poorasmith at protonmail dot com
  2021-05-07 22:08 ` [Bug fortran/100478] " anlauf at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: poorasmith at protonmail dot com @ 2021-05-07 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100478
           Summary: Type Pointer Segfaults
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: poorasmith at protonmail dot com
  Target Milestone: ---

The following program segfaults (11.1.0 and 9.3.0) with "option 2" (pointer
referencing itself) but works fine with "option 1" (direct reference).  Both
options work fine with 7.5.0.

program fortranNull
  implicit none

  type myType
    type(myType), pointer, dimension(:) :: someType => null()
  end type myType

  type(myType),  target, dimension(1) :: typeTarget
  type(myType), pointer, dimension(:) :: typePointer

  character(len=1) :: arg

  call get_command_argument(1, arg) 

  if (arg .eq. '1') then
    write(*,*) 'Direct Assignment'
    typePointer => typeTarget
    typePointer => typeTarget(1)%someType
  else if (arg .eq. '2') then
    write(*,*) 'Referenced Assignment'
    typePointer => typeTarget
    typePointer => typePointer(1)%someType
  else
    write(*,*) 'expected either "1" or "2" command line argument'
  end if

end program fortranNull

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

* [Bug fortran/100478] Type Pointer Segfaults
  2021-05-07 21:26 [Bug fortran/100478] New: Type Pointer Segfaults poorasmith at protonmail dot com
@ 2021-05-07 22:08 ` anlauf at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-07 22:08 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-07

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

Maybe we need a temporary for the second pointer assignment.

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

end of thread, other threads:[~2021-05-07 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 21:26 [Bug fortran/100478] New: Type Pointer Segfaults poorasmith at protonmail dot com
2021-05-07 22:08 ` [Bug fortran/100478] " anlauf 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).