[gcc r16-1150] ada: Fix reproducer generation
Marc Poulhies
dkm@gcc.gnu.org
Thu Jun 5 08:21:43 GMT 2025
https://gcc.gnu.org/g:df0d3b2491c5ee7859762c4b677b17b3dede3dc5
commit r16-1150-gdf0d3b2491c5ee7859762c4b677b17b3dede3dc5
Author: Ronan Desplanques <desplanques@adacore.com>
Date: Mon Jan 20 16:14:21 2025 +0100
ada: Fix reproducer generation
This patch fixes reproducer generation in the case of crashes in the
back end in the presence of preprocessing dependencies.
gcc/ada/ChangeLog:
* generate_minimal_reproducer.adb (Generate_Minimal_Reproducer): Fix
handling of preprocessing dependencies.
Diff:
---
gcc/ada/generate_minimal_reproducer.adb | 50 +++++++++++++++++----------------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/gcc/ada/generate_minimal_reproducer.adb b/gcc/ada/generate_minimal_reproducer.adb
index 2378f60c4729..5a5ae16193e5 100644
--- a/gcc/ada/generate_minimal_reproducer.adb
+++ b/gcc/ada/generate_minimal_reproducer.adb
@@ -140,28 +140,30 @@ begin
end if;
for J in Main_Unit .. Lib.Last_Unit loop
- declare
- Path : File_Name_Type :=
- Fmap.Mapped_Path_Name (Lib.Unit_File_Name (J));
-
- Unit_Name : constant Unit_Name_Type :=
- (if J = Main_Unit then Main_Unit_Name else Lib.Unit_Name (J));
-
- Default_File_Name : constant String :=
- Fname.UF.Get_Default_File_Name (Unit_Name);
-
- File_Copy_Path : constant String :=
- Src_Dir_Path & Directory_Separator & Default_File_Name;
-
- -- We may have synthesized units for child subprograms without
- -- spec files. We need to filter out those units because we would
- -- create bogus spec files that break compilation if we didn't.
- Is_Synthetic_Subprogram_Spec : constant Boolean :=
- not Comes_From_Source (Lib.Cunit (J));
- begin
- if not Lib.Is_Internal_Unit (J)
- and then not Is_Synthetic_Subprogram_Spec
- then
+ -- We skip library units that fall under one of the following cases:
+ -- - Internal library units.
+ -- - Units that were synthesized for child subprograms without spec
+ -- files.
+ -- - Dummy entries that Add_Preprocessing_Dependency puts in
+ -- Lib.Units.
+ -- Those cases correspond to the conjuncts in the condition below.
+ if not Lib.Is_Internal_Unit (J)
+ and then Comes_From_Source (Lib.Cunit (J))
+ and then Lib.Unit_Name (J) /= No_Unit_Name
+ then
+ declare
+ Path : File_Name_Type :=
+ Fmap.Mapped_Path_Name (Lib.Unit_File_Name (J));
+
+ Unit_Name : constant Unit_Name_Type :=
+ (if J = Main_Unit then Main_Unit_Name else Lib.Unit_Name (J));
+
+ Default_File_Name : constant String :=
+ Fname.UF.Get_Default_File_Name (Unit_Name);
+
+ File_Copy_Path : constant String :=
+ Src_Dir_Path & Directory_Separator & Default_File_Name;
+ begin
-- Mapped_Path_Name might have returned No_File. This has been
-- observed for files with a Source_File_Name pragma.
if Path = No_File then
@@ -178,8 +180,8 @@ begin
pragma Assert (Success);
end;
- end if;
- end;
+ end;
+ end if;
end loop;
end Create_Semantic_Closure_Project;
More information about the Gcc-cvs
mailing list