diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-09-09 17:05:41 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-10-08 10:37:13 +0200 |
commit | a6fc30b29f2e89057538500bb7cf2e233d4e5e41 (patch) | |
tree | 56317f000fb598894e1e94c27cb6df2067cef66d | |
parent | 0f7e027e7773fbab82b24e08f60c6da7d3f913a5 (diff) | |
download | gcc-a6fc30b29f2e89057538500bb7cf2e233d4e5e41.zip gcc-a6fc30b29f2e89057538500bb7cf2e233d4e5e41.tar.gz gcc-a6fc30b29f2e89057538500bb7cf2e233d4e5e41.tar.bz2 |
ada: Fix reproducer generation with child subprograms
This patch fixes a corner case that was not handled correctly by
Generate_Minimal_Reproducer.
gcc/ada/ChangeLog:
* generate_minimal_reproducer.adb (Generate_Minimal_Reproducer):
Fix behavior on child subprograms without specs.
-rw-r--r-- | gcc/ada/generate_minimal_reproducer.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/generate_minimal_reproducer.adb b/gcc/ada/generate_minimal_reproducer.adb index d9944f1..ffef91b 100644 --- a/gcc/ada/generate_minimal_reproducer.adb +++ b/gcc/ada/generate_minimal_reproducer.adb @@ -29,6 +29,7 @@ with Lib; with Namet; use Namet; with Osint; use Osint; with Output; use Output; +with Sinfo.Nodes; with System.CRTL; with System.OS_Lib; use System.OS_Lib; with Types; use Types; @@ -126,8 +127,16 @@ begin 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 Sinfo.Nodes.Comes_From_Source (Lib.Cunit (J)); begin - if not Lib.Is_Internal_Unit (J) then + if not Lib.Is_Internal_Unit (J) + and then not Is_Synthetic_Subprogram_Spec + then -- 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 |