From patchwork Mon Aug 6 08:48:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 175300 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 6718C2C0098 for ; Mon, 6 Aug 2012 18:49:00 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1344847741; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=K+KCxpfN18HXuKlXqubZ GYsDBDY=; b=MWGuXaSs0UVfeQfWkJPxekllr4ehI+7xlY5PqQGYrAZFU0WNWPmW AdTPTsgveKzCffS4JpdesufhazSr64Fm7yxld/oy7WY7yHRDQAgXodgiLwMj0lB6 x2D3Uz9/zbT5BFa9DzgUv9dAK7yFsid0MC2qBW2KLD2udRu5r8FF6dE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=hs9x4HOO0v1moMln0VUWaVl37QCa9wlOsNixxR8fiPh2YB3CaxOrwQtwxqJ/xX BdXXthnkAMw45zegza7+IMPElijqhOiaE5qVzT7Oes92za68Quv9QjzXrSglok7S Vp7r9oSyDdi0C2of1J3IlNPuHT0kPHEqBpytnupXF1ksw=; Received: (qmail 26328 invoked by alias); 6 Aug 2012 08:48:56 -0000 Received: (qmail 26320 invoked by uid 22791); 6 Aug 2012 08:48:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO 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; Mon, 06 Aug 2012 08:48:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 732BA1C6DAB; Mon, 6 Aug 2012 04:48:39 -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 I+epTxQ7DPZN; Mon, 6 Aug 2012 04:48:39 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 5A27B1C6D9D; Mon, 6 Aug 2012 04:48:39 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 5B7B592BF6; Mon, 6 Aug 2012 04:48:39 -0400 (EDT) Date: Mon, 6 Aug 2012 04:48:39 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Pucci Subject: [Ada] Reject exponent of dimensioned operand that is unknown at compile-time Message-ID: <20120806084839.GA5288@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 The test presented below illustrates the current patch. ------------ -- Source -- ------------ with System.Dim.Mks; use System.Dim.Mks; with System.Dim.Mks_IO; use System.Dim.Mks_IO; procedure Main is begin for N in -3 .. +3 loop Put (m**N , Aft => 2, Exp => 0); end loop; end Main; ----------------- -- Compilation -- ----------------- $ gcc -c -gnat12 main.adb main.adb:7:13: exponent of dimensioned operand must be known at compile-time compilation abandoned due to previous error Tested on x86_64-pc-linux-gnu, committed on trunk 2012-08-06 Vincent Pucci * sem_dim.adb (Analyze_Dimension_Binary_Op): Issue an error message for unknown exponent at compile-time. Index: sem_dim.adb =================================================================== --- sem_dim.adb (revision 190155) +++ sem_dim.adb (working copy) @@ -1322,9 +1322,12 @@ -- value of the exponent must be known compile time. Otherwise, -- the exponentiation evaluation will return an error message. - if L_Has_Dimensions - and then Compile_Time_Known_Value (R) - then + if L_Has_Dimensions then + if not Compile_Time_Known_Value (R) then + Error_Msg_N ("exponent of dimensioned operand must be " & + "known at compile-time", N); + end if; + declare Exponent_Value : Rational := Zero;