From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17726 invoked by alias); 12 Dec 2008 18:40:45 -0000 Received: (qmail 17717 invoked by uid 22791); 12 Dec 2008 18:40:44 -0000 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, 12 Dec 2008 18:40:09 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 11283290084; Fri, 12 Dec 2008 19:40:07 +0100 (CET) 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 Xw8btD2gx72V; Fri, 12 Dec 2008 19:40:06 +0100 (CET) Received: from province.act-europe.fr (province.act-europe.fr [10.10.0.214]) by mel.act-europe.fr (Postfix) with ESMTP id 71790290082; Fri, 12 Dec 2008 19:40:06 +0100 (CET) Received: by province.act-europe.fr (Postfix, from userid 560) id 6CFF3165B77; Fri, 12 Dec 2008 19:40:06 +0100 (CET) Date: Fri, 12 Dec 2008 18:40:00 -0000 From: Jerome Guitton To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFA/Ada] guard against a malloc failure Message-ID: <20081212184006.GA43597@adacore.com> References: <20081127145701.GB3835@adacore.com> <20081209095142.GL3823@adacore.com> <20081212155749.GA18970@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081212155749.GA18970@adacore.com> User-Agent: Mutt/1.5.17 (2007-11-01) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00233.txt.bz2 Jerome Guitton (guitton@adacore.com): > 2008-12-12 Jerome Guitton > > * ada-lang.c (ada_template_to_fixed_record_type_1): Allocate dval > before a dynamic field is added. Not quite right actually. The assumption that all discriminants are emitted before any dynamic field is wrong. Consider: type X (Dx : Integer) is tagged record Vx : String (1 .. Dx); end record; type Y (Dx : Integer; Dy : Integer) is new X (Dx => Dx) with record Vy : String (1 .. Dy); end record; The layout of Y's fields in memory will be: Dx, Vx, Y, Vy. Apparently the patch does not fail on this case, but I do not understand why. This needs to be clarified. Standby...