From patchwork Mon Oct 29 09:55: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: 194930 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 697F92C008B for ; Mon, 29 Oct 2012 20:55:49 +1100 (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=1352109350; 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=HcUJMOxHQfnIzMcbIdle vzOieSw=; b=gPI61FOJtKwSTGk0VwEZPnRDMOK1+ggRxTG6/9k62Qx4h4l/CPeD VffM7wLfVhX9b1T3EsTPW/TOkIeLMA4Jww2XOkb2p8O/hVLkElcBV9go4NUeFiLQ WW571kJq7gHS5SnZ09yWedFTsq+CeR2gKLNAonj1q5dvW9jc54ar5f8= 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=VNcwJ+nQ9AVkLSfTmMQ+PgpI+tWFk6LE+6zsh/2ZhZlDsS4KwHKMOhTqJHws8G 4O8S85rlijvXmNfwSMb8ykD4AJMl6u+YRsmEN0qjBEhBRKvOdnQ85id/SmL6jz/2 qUYKlJzJEy+53D/hjTm5lSB3ZDiRz8/zqOdnmw1A8m3gw=; Received: (qmail 19991 invoked by alias); 29 Oct 2012 09:55:46 -0000 Received: (qmail 19983 invoked by uid 22791); 29 Oct 2012 09:55:46 -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, 29 Oct 2012 09:55:39 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3E1711C7DA9; Mon, 29 Oct 2012 05:55: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 ljCy3PtFdE-Y; Mon, 29 Oct 2012 05:55:39 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 215741C7D72; Mon, 29 Oct 2012 05:55:39 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 1ACCD3FF09; Mon, 29 Oct 2012 05:55:39 -0400 (EDT) Date: Mon, 29 Oct 2012 05:55:39 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [Ada] Special case for case expression alternative moved in caller Message-ID: <20121029095538.GA14620@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 Is_Signed_Integer_Arithmetic_Op is called to recognize an arithmetic operation on signed integers, or on if expressions and case expressions whose dependent expressions are arithmetic operation on signed integers. A special case was included for N_Case_Expression_Alternative which should have been included in the caller Apply_Arithmetic_Overflow_Minimized_Eliminated. Now done. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-10-29 Yannick Moy * checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated): Add special case for case expression alternative. (Is_Signed_Integer_Arithmetic_Op): Remove special case for case expression alternative. * exp_ch4.adb Minor reformatting. Index: checks.adb =================================================================== --- checks.adb (revision 192908) +++ checks.adb (working copy) @@ -1108,8 +1108,12 @@ or else Nkind (P) in N_Membership_Test or else Nkind (P) in N_Op_Compare - -- We may also be a range operand in a membership test + -- This is also true for an alternative in a case expression + or else Nkind (P) = N_Case_Expression_Alternative + + -- This is also true for a range operand in a membership test + or else (Nkind (P) = N_Range and then Nkind (Parent (P)) in N_Membership_Test) then @@ -6268,9 +6272,6 @@ when N_If_Expression | N_Case_Expression => return Is_Signed_Integer_Type (Etype (N)); - when N_Case_Expression_Alternative => - return Is_Signed_Integer_Type (Etype (Parent (N))); - when others => return False; end case; Index: exp_ch4.adb =================================================================== --- exp_ch4.adb (revision 192908) +++ exp_ch4.adb (working copy) @@ -3877,8 +3877,8 @@ end if; -- Right operand is a subtype name and the subtype has a predicate. We - -- have to make sure predicate is checked, and for that we need to use - -- the standard N_In circuitry with appropriate types. + -- have to make sure the predicate is checked, and for that we need to + -- use the standard N_In circuitry with appropriate types. else pragma Assert (Present (Predicate_Function (Etype (Rop)))); @@ -3921,7 +3921,7 @@ -- Bnn -- end - -- A bit gruesome, but here goes. + -- A bit gruesome, but there doesn't seem to be a simpler way declare Blk : constant Node_Id := Make_Bignum_Block (Loc); @@ -3937,10 +3937,8 @@ Nin := Make_In (Loc, - Left_Opnd => - Convert_To (Base_Type (Etype (Rop)), - New_Occurrence_Of (Lnn, Loc)), - Right_Opnd => New_Occurrence_Of (Etype (Rop), Loc)); + Left_Opnd => Convert_To (TB, New_Occurrence_Of (Lnn, Loc)), + Right_Opnd => New_Occurrence_Of (T, Loc)); Set_No_Minimize_Eliminate (Nin); -- Now decorate the block