aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-06-05 10:40:35 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-21 10:34:21 +0200
commit728c1454c2b405543687d80238d8af4f12bcdca2 (patch)
treed4b1088a6a427e9bcb8b92ceb474a354e7a1321c
parent96e037bcd160d2f63a04de09f2d47ed9aae082ad (diff)
downloadgcc-728c1454c2b405543687d80238d8af4f12bcdca2.zip
gcc-728c1454c2b405543687d80238d8af4f12bcdca2.tar.gz
gcc-728c1454c2b405543687d80238d8af4f12bcdca2.tar.bz2
ada: Fix crash in GNATbind during error reporting
This is the minimal fix to avoid the crash. gcc/ada/ * bcheck.adb (Check_Consistency_Of_Sdep): Guard against path to ALI file not found.
-rw-r--r--gcc/ada/bcheck.adb10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb
index 56a417c..64a6734 100644
--- a/gcc/ada/bcheck.adb
+++ b/gcc/ada/bcheck.adb
@@ -162,10 +162,14 @@ package body Bcheck is
end if;
else
- ALI_Path_Id :=
- Osint.Full_Lib_File_Name (A.Afile);
+ ALI_Path_Id := Osint.Full_Lib_File_Name (A.Afile);
+
+ -- Guard against Find_File not finding (again) the file because
+ -- Primary_Directory has been clobbered in between.
- if Osint.Is_Readonly_Library (ALI_Path_Id) then
+ if Present (ALI_Path_Id)
+ and then Osint.Is_Readonly_Library (ALI_Path_Id)
+ then
if Tolerate_Consistency_Errors then
Error_Msg ("?{ should be recompiled");
Error_Msg_File_1 := ALI_Path_Id;