re PR ada/28733 (GNAT crash while compiling Ada-2005 code)

2008-04-15  Samuel Tardieu  <sam@rfc1149.net>
            Gary Dismukes  <dismukes@adacore.com>

    gcc/ada/
	PR ada/28733
	* sem_ch8.adb (Analyze_Use_Package): Do not allow "use" of something
	which is not an entity (and hence not a package).
	(End_Use_Package): Ditto.

Co-Authored-By: Gary Dismukes <dismukes@adacore.com>

From-SVN: r134313
This commit is contained in:
Samuel Tardieu 2008-04-15 11:59:39 +00:00 committed by Samuel Tardieu
parent 8abe457acb
commit 462c31ef75
2 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2008-04-15 Samuel Tardieu <sam@rfc1149.net>
Gary Dismukes <dismukes@adacore.com>
PR ada/28733
* sem_ch8.adb (Analyze_Use_Package): Do not allow "use" of something
which is not an entity (and hence not a package).
(End_Use_Package): Ditto.
2008-04-15 Ed Schonberg <schonberg@adacore.com>
PR ada/16086

View file

@ -2396,6 +2396,11 @@ package body Sem_Ch8 is
Use_One_Package (Pack, N);
end if;
end if;
-- Report error because name denotes something other than a package
else
Error_Msg_N ("& is not a package", Pack_Name);
end if;
Next (Pack_Name);
@ -3066,9 +3071,14 @@ package body Sem_Ch8 is
begin
Pack_Name := First (Names (N));
while Present (Pack_Name) loop
Pack := Entity (Pack_Name);
if Ekind (Pack) = E_Package then
-- Test that Pack_Name actually denotes a package before processing
if Is_Entity_Name (Pack_Name)
and then Ekind (Entity (Pack_Name)) = E_Package
then
Pack := Entity (Pack_Name);
if In_Open_Scopes (Pack) then
null;