From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A1D023858D28; Mon, 12 Jun 2023 08:17:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1D023858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686557823; bh=UALD+zWRmZGjutq0mEM4jHn7xj4Ty+ocAyqdkXtUhas=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oB+wd0lAQDdySViQo58pCyMYJP5VLmaY/jqd9CL1eMSDsq1LIxD+HQ35vEOvuU+l5 p3FaXYDZF3cR6J4sCpmHEceYrM+VadK5A3/297XWfppqKBTmSiwXWRI2xVyF1NIHdV SEl8P94sxPWhKmj7apnjIoM9r2TzsSgrlbzwOqaY= From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/86277] Presence of optional arguments not recognized for zero length arrays Date: Mon, 12 Jun 2023 08:17:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 8.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D86277 --- Comment #24 from Mikael Morin --- (In reply to Mikael Morin from comment #23) >=20 > This regresses on pr108065.f90 (that's a few extra analyzer warnings), > and on pr69955.f90 (that's one extra __builtin_malloc). This removes the regressions. Not fully retested again. diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 1c7ea900ea1..7ae7eacca0b 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -1117,7 +1117,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, desc =3D info->descriptor; info->offset =3D gfc_index_zero_node; - if (size =3D=3D NULL_TREE || integer_zerop (size)) + if (size =3D=3D NULL_TREE || (dynamic && integer_zerop (size))) { /* A callee allocated array. */ gfc_conv_descriptor_data_set (pre, desc, null_pointer_node);=