diff options
author | Bob Duff <duff@adacore.com> | 2021-05-12 11:56:47 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2021-05-12 12:15:55 +0200 |
commit | ac18ded230f1559f271f8d66121b2f16805f0b27 (patch) | |
tree | f4bd24814c747e04b2268d864479cdada523bfbb /gcc/ada/atree.ads | |
parent | 3835aa0eb90292d652dd6b200f302f3cac7e643f (diff) | |
download | gcc-ac18ded230f1559f271f8d66121b2f16805f0b27.zip gcc-ac18ded230f1559f271f8d66121b2f16805f0b27.tar.gz gcc-ac18ded230f1559f271f8d66121b2f16805f0b27.tar.bz2 |
Fix uninitialized variable in Atree.Size_In_Slots
Size_In_Slots uses the Nkind to look up the size in a table indexed
by Nkind. This patch fixes a couple of places where the Nkind is
wrong (uninitialized or zeroed out) so Size_In_Slots cannot be used.
gcc/ada/
PR ada/100564
* atree.adb (Change_Node): Do not call Zero_Slots on a Node_Id
when the Nkind has not yet been set; call the other Zero_Slots
that takes a range of slot offsets. Call the new Mutate_Kind
that takes an Old_Size, for the same reason -- the size cannot
be computed without the Nkind.
(Mutate_Nkind): New function that allows specifying the Old_Size.
(Size_In_Slots): Assert that the Nkind has proper (nonzero) value.
* atree.ads: Minor reformatting.
Diffstat (limited to 'gcc/ada/atree.ads')
-rw-r--r-- | gcc/ada/atree.ads | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index efb8ca2..e2d3492 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -571,8 +571,7 @@ package Atree is (N : Entity_Id; Field : Entity_Field) return Boolean; -- True if the field value is the initial zero value - procedure Mutate_Nkind - (N : Node_Id; Val : Node_Kind) with Inline; + procedure Mutate_Nkind (N : Node_Id; Val : Node_Kind) with Inline; -- There is no Set_Nkind in Sinfo.Nodes. We use this instead. This is here, -- and has a different name, because it does some extra checking. Nkind is -- like a discriminant, in that it controls which fields exist, and that |