Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jerome Guitton <guitton@adacore.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/Ada] guard against a malloc failure
Date: Fri, 12 Dec 2008 18:40:00 -0000	[thread overview]
Message-ID: <20081212184006.GA43597@adacore.com> (raw)
In-Reply-To: <20081212155749.GA18970@adacore.com>

Jerome Guitton (guitton@adacore.com):

> 2008-12-12  Jerome Guitton  <guitton@adacore.com>
> 
> 	* 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...




  reply	other threads:[~2008-12-12 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081127145701.GB3835@adacore.com>
2008-12-09  9:52 ` Joel Brobecker
2008-12-12 15:58   ` Jerome Guitton
2008-12-12 18:40     ` Jerome Guitton [this message]
2009-02-04 16:10 ` Jerome Guitton
2009-02-04 16:20   ` Joel Brobecker
2009-02-04 17:47     ` Jerome Guitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081212184006.GA43597@adacore.com \
    --to=guitton@adacore.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox