if Present (Aspect_Rep_Item (N)) then
Assert (Nkind (Aspect_Rep_Item (N)) = N_Pragma,
Check_Corresponding_Aspect);
- Assert (From_Aspect_Specification (Aspect_Rep_Item (N)),
- Check_Corresponding_Aspect);
- Assert (Corresponding_Aspect (Aspect_Rep_Item (N)) = N,
- Check_Corresponding_Aspect);
+
+ -- If the above check fails, the test below may raise predicate
+ -- failures, no need to check for pragma/aspect consistency for
+ -- other nodes.
+ if Nkind (Aspect_Rep_Item (N)) = N_Pragma then
+ Assert (From_Aspect_Specification (Aspect_Rep_Item (N)),
+ Check_Corresponding_Aspect);
+ Assert (Corresponding_Aspect (Aspect_Rep_Item (N)) = N,
+ Check_Corresponding_Aspect);
+ end if;
end if;
end if;