public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/86277] Presence of optional arguments not recognized for zero length arrays Date: Sat, 10 Jun 2023 11:45:11 +0000 [thread overview] Message-ID: <bug-86277-4-EQqHMSaHao@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-86277-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86277 --- Comment #12 from Mikael Morin <mikael at gcc dot gnu.org> --- (In reply to anlauf from comment #8) > Enabling derived types does not work when they occur in an array constructor, > and the code would ICE on empty constructors of derived type. > Looking at the code, I couldn't foresee where the ICE would happen, so I tried it myself. I see no ICE here. diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 04b5e30b96a..4fd3fb65a54 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -2941,10 +2941,6 @@ trans_array_constructor (gfc_ss * ss, locus * where) from constructor only for meaningful shape. */ bool zero_sized = zero_sized_array_p (expr); - /* FIXME: constant array constructors for DT have some issues... */ - if (expr->ts.type == BT_DERIVED || expr->ts.type == BT_CLASS) - zero_sized = false; - if (!zero_sized) nelem = gfc_constant_array_constructor_p (c); program test implicit none type :: t integer :: c end type t integer :: m(0) integer, allocatable :: n(:) call i call i(m) call i(n) allocate (n(0)) call i(n) call i([integer::]) ! expect "optional argument present: T" call i([1]) call j([t::]) contains subroutine i(str) integer, dimension(:), optional, intent(in) :: str write(6,*) 'optional argument present:', present(str) end subroutine i subroutine j(str) type(t), dimension(:), optional, intent(in) :: str write(6,*) 'optional argument present:', present(str) end subroutine j end program
next prev parent reply other threads:[~2023-06-10 11:45 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-86277-4@http.gcc.gnu.org/bugzilla/> 2020-03-12 11:58 ` jakub at gcc dot gnu.org 2021-06-01 8:11 ` rguenth at gcc dot gnu.org 2022-05-27 8:19 ` rguenth at gcc dot gnu.org 2023-06-09 19:48 ` anlauf at gcc dot gnu.org 2023-06-09 19:48 ` anlauf at gcc dot gnu.org 2023-06-10 10:27 ` mikael at gcc dot gnu.org 2023-06-10 10:30 ` mikael at gcc dot gnu.org 2023-06-10 10:40 ` mikael at gcc dot gnu.org 2023-06-10 11:45 ` mikael at gcc dot gnu.org [this message] 2023-06-10 13:21 ` anlauf at gcc dot gnu.org 2023-06-10 13:25 ` anlauf at gcc dot gnu.org 2023-06-10 19:27 ` anlauf at gcc dot gnu.org 2023-06-10 19:55 ` mikael at gcc dot gnu.org 2023-06-10 20:07 ` mikael at gcc dot gnu.org 2023-06-10 20:17 ` mikael at gcc dot gnu.org 2023-06-10 20:33 ` mikael at gcc dot gnu.org 2023-06-11 20:44 ` anlauf at gcc dot gnu.org 2023-06-12 7:13 ` mikael at gcc dot gnu.org 2023-06-12 7:39 ` mikael at gcc dot gnu.org 2023-06-12 7:56 ` mikael at gcc dot gnu.org 2023-06-12 8:17 ` mikael at gcc dot gnu.org 2023-06-12 10:38 ` mikael at gcc dot gnu.org 2023-06-12 19:42 ` anlauf at gcc dot gnu.org 2023-06-12 19:47 ` anlauf at gcc dot gnu.org 2023-06-12 20:16 ` mikael at gcc dot gnu.org 2023-06-12 20:32 ` anlauf at gcc dot gnu.org 2023-06-12 20:51 ` mikael at gcc dot gnu.org 2023-06-12 21:00 ` anlauf at gcc dot gnu.org 2023-06-12 21:14 ` anlauf at gcc dot gnu.org 2023-06-13 18:09 ` cvs-commit at gcc dot gnu.org 2023-06-13 19:30 ` anlauf at gcc dot gnu.org 2023-06-29 19:50 ` cvs-commit at gcc dot gnu.org 2023-06-29 19:53 ` anlauf at gcc dot gnu.org
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=bug-86277-4-EQqHMSaHao@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).