public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-9055] Backported from master: Date: Sat, 21 Jan 2023 23:09:42 +0000 (GMT) [thread overview] Message-ID: <20230121230942.5CA6F3858D32@sourceware.org> (raw) https://gcc.gnu.org/g:6d307fda2b9ba71fe18f1449f7444bed7ff05193 commit r12-9055-g6d307fda2b9ba71fe18f1449f7444bed7ff05193 Author: Jerry DeLisle <jvdelisle@gcc.gnu.org> Date: Sat Jan 21 14:58:05 2023 -0800 Backported from master: PR fortran/106731 gcc/fortran/ChangeLog: * trans-array.cc (gfc_trans_auto_array_allocation): Remove gcc_assert (!TREE_STATIC()). gcc/testsuite/ChangeLog: * gfortran.dg/pr106731.f90: New test. Diff: --- gcc/fortran/trans-array.cc | 1 - gcc/testsuite/gfortran.dg/pr106731.f90 | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 514cb057afb..f7097ee4165 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -6614,7 +6614,6 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, type = TREE_TYPE (type); gcc_assert (!sym->attr.use_assoc); - gcc_assert (!TREE_STATIC (decl)); gcc_assert (!sym->module); if (sym->ts.type == BT_CHARACTER diff --git a/gcc/testsuite/gfortran.dg/pr106731.f90 b/gcc/testsuite/gfortran.dg/pr106731.f90 new file mode 100644 index 00000000000..470830c7069 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr106731.f90 @@ -0,0 +1,58 @@ +! { dg-do run } +! PR106731 ICE on automatic array of derived type +module causes_ice + implicit none + + type :: t + real(8) :: x + contains + procedure, private :: write_formatted + generic :: write(formatted) => write_formatted + end type t + + contains + + subroutine write_formatted(this, unit, iotype, v_list, iostat, iomsg) + class(t), intent(in) :: this + integer, intent(in) :: unit + character(*), intent(in) :: iotype + integer, intent(in) :: v_list(:) + integer, intent(out) :: iostat + character(*), intent(inout) :: iomsg + write(unit, '(a,3x,f10.5)', iostat=iostat, iomsg=iomsg) 'dummy', this%x + end subroutine write_formatted + +end module causes_ice + +module use_t + use causes_ice + implicit none + + public :: automatic_alloc + + contains + + subroutine automatic_alloc(n) + integer, intent(in) :: n + + ! Automatic array: ICE! + type(t) :: automatic(n) + + ! Allocatable: works + type(t), allocatable :: alloc(:) + allocate(alloc(n)) + + automatic%x = 42.34675_8 + + ! Do anything + print *, 'n=',n,automatic%x + print *, 'n=',n,automatic + + end subroutine automatic_alloc + +end module use_t + +program test + use use_t + call automatic_alloc(1) +end program test
reply other threads:[~2023-01-21 23:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230121230942.5CA6F3858D32@sourceware.org \ --to=jvdelisle@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).