This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/Ada] guard against a malloc failure


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...




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]