[RFA/Ada] guard against a malloc failure
Jerome Guitton
guitton@adacore.com
Fri Dec 12 18:40:00 GMT 2008
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...
More information about the Gdb-patches
mailing list