From patchwork Thu Oct 13 10:34:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 119406 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 8AF6CB6F86 for ; Thu, 13 Oct 2011 21:35:11 +1100 (EST) Received: (qmail 22628 invoked by alias); 13 Oct 2011 10:35:09 -0000 Received: (qmail 22560 invoked by uid 22791); 13 Oct 2011 10:35:08 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Oct 2011 10:34:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 57F382BAF98; Thu, 13 Oct 2011 06:34:54 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZxC-D86QH6oX; Thu, 13 Oct 2011 06:34:54 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 29A2B2BAF96; Thu, 13 Oct 2011 06:34:54 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 206BF92BF6; Thu, 13 Oct 2011 06:34:54 -0400 (EDT) Date: Thu, 13 Oct 2011 06:34:54 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] Unchecked union types can be limited Message-ID: <20111013103454.GA17693@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 This patch removes an improper check on type to which the pragma Unchecked_Union applies. Such a type can be limitied. The following must compile quietly: package UU is type Val is (One, Two); type T (X : Val := One) is limited record case X is when One => A : Long_Long_Integer; when Two => B : Boolean; end case; end record; pragma Unchecked_Union (T); end UU; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-10-13 Ed Schonberg * sem_prag.adb (Analyze_Pragma, case Unchecked_Union): an unchecked union type can be limited. Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 179894) +++ sem_prag.adb (working copy) @@ -13762,12 +13762,6 @@ Error_Msg_N ("Unchecked_Union must not be tagged", Typ); return; - elsif Is_Limited_Type (Typ) then - Error_Msg_N - ("Unchecked_Union must not be limited record type", Typ); - Explain_Limited_Type (Typ, Typ); - return; - else if not Has_Discriminants (Typ) then Error_Msg_N