From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) by sourceware.org (Postfix) with ESMTPS id A590A3858439 for ; Tue, 19 Jul 2022 09:03:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A590A3858439 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=orange.fr Received: from [192.168.1.17] ([86.215.161.154]) by smtp.orange.fr with ESMTPA id Dj8io41GXvbzbDj8oo56Ep; Tue, 19 Jul 2022 11:03:43 +0200 X-ME-Helo: [192.168.1.17] X-ME-Auth: MDU4MTIxYWM4YWI0ZGE4ZTUwZWZmNTExZmI2ZWZlMThkM2ZhYiE5OWRkOGM= X-ME-Date: Tue, 19 Jul 2022 11:03:43 +0200 X-ME-IP: 86.215.161.154 Message-ID: <0342ad62-3f9c-4fbb-bd00-f4d4a6b49fc7@orange.fr> Date: Tue, 19 Jul 2022 11:03:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] Fortran: error recovery on invalid array reference of non-array [PR103590] Content-Language: en-US To: Harald Anlauf , fortran , gcc-patches References: From: Mikael Morin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 09:03:46 -0000 Hello, the principle looks good, but... Le 18/07/2022 à 22:43, Harald Anlauf via Fortran a écrit : > diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc > index 2ebf076f730..dacd33561d0 100644 > --- a/gcc/fortran/resolve.cc > +++ b/gcc/fortran/resolve.cc > @@ -5004,7 +5004,11 @@ find_array_spec (gfc_expr *e) > { > case REF_ARRAY: > if (as == NULL) > - gfc_internal_error ("find_array_spec(): Missing spec"); > + { > + gfc_error ("Symbol %qs at %L has not been declared as an array", > + e->symtree->n.sym->name, &e->where); ... the error here only makes sense if the array reference follows a variable reference. If it follows a derived type component reference, a slightly different error message would be more appropriate.