From patchwork Fri Jun 18 14:19:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56192 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 44C531007D4 for ; Sat, 19 Jun 2010 00:19:31 +1000 (EST) Received: (qmail 21135 invoked by alias); 18 Jun 2010 14:19:30 -0000 Received: (qmail 21126 invoked by uid 22791); 18 Jun 2010 14:19:29 -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; Fri, 18 Jun 2010 14:19:24 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id ECB84CB0287; Fri, 18 Jun 2010 16:19:31 +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 AubiJExRCLdw; Fri, 18 Jun 2010 16:19:31 +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 D6361CB0277; Fri, 18 Jun 2010 16:19:31 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 15DBDD9B31; Fri, 18 Jun 2010 16:19:42 +0200 (CEST) Date: Fri, 18 Jun 2010 16:19:42 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Bad initialization of dynamic tables in gnatname ... --and ... Message-ID: <20100618141942.GA5325@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 Dynamic tables in the implementation of gnatname when switch --and is used were not properly initialized. This patch ensures that they are. There is no known simple test for this. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-18 Vincent Celier * gnatname.adb (Scan_Args): When --and is used, make sure that the dynamic tables in the newly allocated Argument_Data are properly initialized. Index: gnatname.adb =================================================================== --- gnatname.adb (revision 160959) +++ gnatname.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2010, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -306,7 +306,16 @@ procedure Gnatname is -- Add and initialize another component to Arguments table - Arguments.Increment_Last; + declare + New_Arguments : Argument_Data; + pragma Warnings (Off, New_Arguments); + -- Declaring this defaulted itialized object ensures that + -- the new allocated component of table Arguments is + -- correctly initialized. + + begin + Arguments.Append (New_Arguments); + end; Patterns.Init (Arguments.Table (Arguments.Last).Directories);