The -gnatec switch is used to specify configuration files containing that contain configuration pragmas. With This patch the compiler rejects properly a name for a configuration file that designates a directory rather than crashing.
Executing gcc -c pkg.ads -gnatec=. must yield: gnat1: cannot find configuration pragmas file . --- package pkg is private end; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Ed Schonberg <schonb...@adacore.com> * osint.adb (Find_File): Handle properly a request for a configuration file whose name is a directory.
Index: osint.adb =================================================================== --- osint.adb (revision 247135) +++ osint.adb (working copy) @@ -1189,16 +1189,25 @@ Found := N; Attr.all := Unknown_Attributes; - if T = Config and then Full_Name then - declare - Full_Path : constant String := - Normalize_Pathname (Get_Name_String (N)); - Full_Size : constant Natural := Full_Path'Length; - begin - Name_Buffer (1 .. Full_Size) := Full_Path; - Name_Len := Full_Size; - Found := Name_Find; - end; + if T = Config then + if Full_Name then + declare + Full_Path : constant String := + Normalize_Pathname (Get_Name_String (N)); + Full_Size : constant Natural := Full_Path'Length; + + begin + Name_Buffer (1 .. Full_Size) := Full_Path; + Name_Len := Full_Size; + Found := Name_Find; + end; + end if; + + -- Check that it is a file, not a directory + + if not Is_Regular_File (Get_Name_String (Found)) then + Found := No_File; + end if; end if; return;