From patchwork Thu Jun 14 10:46:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 164908 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 09C951007D1 for ; Thu, 14 Jun 2012 20:46:44 +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=1340275606; 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=Zqkd5UqUh1OzuynHumF6 n5Pxn40=; b=PtIqQPNzNNW/XRFrbVEEADNmcmTF/2o1grEmdVTe0uzNX3YzXBO6 KmRAYeaICznNLbQg8m/mD30JztEUoN8iHlomBS/av1foY4vPx4Sbmz3S7o0zfyi/ YT4IXhJqTjGe3iP+ATuVYjN7C2brFPpEOXVOO2hrqTjSYWNf/vsSIwY= 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=JgWma7wWWuQ8jyDaMVwPnaZdE6pCxdCciwACtXfqhSnyFDz3B2gooCWphwRT19 PpYfTdmtQZDP/SLoEyhQ1r9nrB0m1S8nxspWaXS8cHAT/mwAbcvwZ5baLOhsJKvi P9711PkAX4E+43VeSkOR8acsLDwSC8gAMKR7a93unGWgQ=; Received: (qmail 26758 invoked by alias); 14 Jun 2012 10:46:40 -0000 Received: (qmail 26749 invoked by uid 22791); 14 Jun 2012 10:46:39 -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; Thu, 14 Jun 2012 10:46:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6CD8F1C6E70; Thu, 14 Jun 2012 06:46:26 -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 5p6TJGR1j60Z; Thu, 14 Jun 2012 06:46:26 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 39B481C6E69; Thu, 14 Jun 2012 06:46:26 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 312B192BF6; Thu, 14 Jun 2012 06:46:26 -0400 (EDT) Date: Thu, 14 Jun 2012 06:46:26 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Tristan Gingold Subject: [Ada] Fix crash in gnatname due to uninitialized variable Message-ID: <20120614104625.GA15184@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 No functional change. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-06-14 Tristan Gingold * gnatname.adb (Gnatname): Make sure that dynamic table argument_data is initialized. Index: gnatname.adb =================================================================== --- gnatname.adb (revision 188605) +++ gnatname.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2012, 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- -- @@ -575,7 +575,15 @@ -- Initialize tables Arguments.Set_Last (0); - Arguments.Increment_Last; + declare + New_Arguments : Argument_Data; + pragma Warnings (Off, New_Arguments); + -- Declaring this defaulted initialized object ensures + -- that the new allocated component of table Arguments + -- is correctly initialized. + begin + Arguments.Append (New_Arguments); + end; Patterns.Init (Arguments.Table (1).Directories); Patterns.Set_Last (Arguments.Table (1).Directories, 0); Patterns.Init (Arguments.Table (1).Name_Patterns);