From: Samuel Tardieu Date: Tue, 15 Apr 2008 11:59:39 +0000 (+0000) Subject: re PR ada/28733 (GNAT crash while compiling Ada-2005 code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=462c31ef75b495fd95f18a91864c471d2cb76494;p=gcc.git re PR ada/28733 (GNAT crash while compiling Ada-2005 code) 2008-04-15 Samuel Tardieu Gary Dismukes 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 From-SVN: r134313 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cec2e8cb2e5..67434655c8e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2008-04-15 Samuel Tardieu + Gary Dismukes + + 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 PR ada/16086 diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 2d4d7fe4635..3b28bdfe868 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -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;