From patchwork Mon Jun 14 12:25:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 55522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1DEF5B7D9A for ; Mon, 14 Jun 2010 22:25:13 +1000 (EST) Received: (qmail 27381 invoked by alias); 14 Jun 2010 12:25:11 -0000 Received: (qmail 27247 invoked by uid 22791); 14 Jun 2010 12:24:59 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jun 2010 12:24:54 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5CD18CB021C; Mon, 14 Jun 2010 14:24:56 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a5l8tTxrFY4u; Mon, 14 Jun 2010 14:24:56 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 49266CB021B; Mon, 14 Jun 2010 14:24:56 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 7117FD9B31; Mon, 14 Jun 2010 14:25:03 +0200 (CEST) Date: Mon, 14 Jun 2010 14:25:03 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] Missing error on illegal expanded name Message-ID: <20100614122503.GA6740@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org If an expanded name P.S is illegal, and P is an open scope, we examine the context to determine whether there is a compilation unit in the context, named P, that may be hidden by the scope P, and specialize the error message if the outer P does contain an entity named S. If there is no such entity, and there is no other semantic error in the program, the reference was left unresolved but no error message was emitted, leading to a back-end crash. This patch fixes ths oversight by generating the proper error message. Compiling the following must yield: b-a.adb:7:06: "Bar" not declared in "A" package A is procedure Do_It; end A; --- package B is procedure Bla; end B; --- package B.A is procedure Foo; end B.A; --- with A; package body B.A is procedure Foo is begin A.Bar; -- ERROR end Foo; end B.A; -- Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-14 Ed Schonberg * sem_ch8.adb (Find_Expanded_Name): If a candidate compilation unit in the context does not have a homonym of the selector, emit default error message. Index: sem_ch8.adb =================================================================== --- sem_ch8.adb (revision 160711) +++ sem_ch8.adb (working copy) @@ -4785,11 +4785,17 @@ package body Sem_Ch8 is ("\use fully qualified name starting with" & " Standard to make& visible", N, H); Error_Msg_Qual_Level := 0; - exit; + goto Done; end if; Next_Entity (Id); end loop; + + -- If not found, standard error message. + + Error_Msg_NE ("& not declared in&", N, Selector); + + <> null; end; else