https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114640
--- Comment #1 from simon at pushface dot org ---
It turns out that the error does not occur if I change
if First_Term = Invalid_Node_Access then
-- Empty or all virtual
return Invalid_Line_Number;
elsif not Contains
((First =>
to
if First_Term = Invalid_Node_Access then
-- Empty or all virtual
return Invalid_Line_Number;
end if;
if not Contains
((First =>
