public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114021] New: ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer
@ 2024-02-20 21:02 kargl at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: kargl at gcc dot gnu.org @ 2024-02-20 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114021
           Summary: ICE with allocation of scalar pointer entity where
                    SOURCE=f() with f() returning a pointer
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

Note sure if this is legal Fortran, but it leads to an ICE.
Reduced testcase from Fujitsu testsuite.

!
! https://github.com/fujitsu/compiler-test-suite
! Reduced from 0077/0077_0005.f90
!
module m1
   type y
      integer, allocatable:: x1(:)
   end type

   type(y), target :: w
   integer :: c = 0

   contains

      function f()
         type(y), pointer :: f
         f => w
         c = c + 1
      end function
end

subroutine s2
   use m1
!   type(y), allocate :: x  ! This ICEs as well
   type(y), pointer :: x
   allocate(x, source = f())
end

   use m1
   call s2
   if (c /= 1) stop
end


% gfcx -o z 0077/0077_0005.f90
0077/0077_0005.f90:21:28:

   21 |    allocate(x, source = f())
      |                            1
internal compiler error: Segmentation fault
0x109b292 crash_signal
        ../../gccx/gcc/toplev.cc:317
0x2470c137f handle_signal
        /usr/src/lib/libthr/thread/thr_sig.c:301
0x2470c09b7 thr_sighandler
        /usr/src/lib/libthr/thread/thr_sig.c:244
0xacea7d tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gccx/gcc/tree.h:3611
0xacea7d gfc_trans_allocate(gfc_code*, gfc_omp_namelist*)
        ../../gccx/gcc/fortran/trans-stmt.cc:6672

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-20 21:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 21:02 [Bug fortran/114021] New: ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer kargl 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).