This patch fixes a failure of name resolution when
a range attribute reference appears in a Ghost_Predicate
and the ghost policy is Ignore.
gcc/ada/
* sem_ch13.adb (Add_Predicate): Remove the premature "return;".
Ghost code needs to be processed by later code in this procedure
even when ignored; otherwise the second pass of name resolution
fails much later. However, protect Set_SCO_Pragma_Enabled and
Add_Condition with "if not Is_Ignored_Ghost_Pragma"; these parts
should not happen if the ghost code is Ignored.
* libgnat/interfac__2020.ads (Unsigned_8): Minor reformatting.
* libgnat/interfac.ads (IEEE_Extended_Float): Minor comment
improvement.
-- such as SPARK or CodePeer. In the normal case Long_Long_Integer is
-- always 64-bits so we get the desired 64-bit type.
- type Unsigned_8 is mod 2 ** 8;
+ type Unsigned_8 is mod 2 ** 8;
for Unsigned_8'Size use 8;
type Unsigned_16 is mod 2 ** 16;
-- Note: it is harmless, and explicitly permitted, to include additional
-- types in interfaces, so it is not wrong to have IEEE_Extended_Float
-- defined even if the extended format is not available.
+ -- See RM-B.2(11).
type IEEE_Extended_Float is new Long_Long_Float;
if Is_Ignored_Ghost_Pragma (Prag) then
Add_Condition (New_Occurrence_Of (Standard_True, Sloc (Prag)));
- return;
- end if;
- -- Mark corresponding SCO as enabled
+ else
+ -- Mark corresponding SCO as enabled
- Set_SCO_Pragma_Enabled (Sloc (Prag));
+ Set_SCO_Pragma_Enabled (Sloc (Prag));
+ end if;
-- Extract the arguments of the pragma
-- "and"-in the Arg2 condition to evolving expression
- Add_Condition (Arg2_Copy);
+ if not Is_Ignored_Ghost_Pragma (Prag) then
+ Add_Condition (Arg2_Copy);
+ end if;
end;
end if;
end Add_Predicate;