diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2018-07-17 08:11:32 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-07-17 08:11:32 +0000 |
commit | 7ffb58afe1ad318ccf289325e802d913bd8e0e15 (patch) | |
tree | 751691ac5b6406a18f27526c39b6a184f754e838 /gcc | |
parent | 9cc97ad523d17ce6ae643030e5f99fe5acb68bea (diff) | |
download | gcc-7ffb58afe1ad318ccf289325e802d913bd8e0e15.zip gcc-7ffb58afe1ad318ccf289325e802d913bd8e0e15.tar.gz gcc-7ffb58afe1ad318ccf289325e802d913bd8e0e15.tar.bz2 |
[Ada] Faulty ignored Ghost code removal
This patch ensures that removal of ignored Ghost code is the absolute last
operation performed on the tree. Previously the removal was performed prior to
issuing delayed warnings, however the warning mechanism may see a heavily
modified tree and fail.
No small reproducer available.
2018-07-17 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* frontend.adb (Frontend): The removal of ignored Ghost code must be
the last semantic operation performed on the tree.
From-SVN: r262795
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/frontend.adb | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9fe7a3b..1b8da21 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2018-07-17 Hristian Kirtchev <kirtchev@adacore.com> + * frontend.adb (Frontend): The removal of ignored Ghost code must be + the last semantic operation performed on the tree. + +2018-07-17 Hristian Kirtchev <kirtchev@adacore.com> + * frontend.adb (Frontend): Update the call to Register_Config_Switches. * inline.ads: Add new component Config_Switches to record Pending_Body_Info which captures the configuration state of the pending diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb index 1af5587..1da6f9a 100644 --- a/gcc/ada/frontend.adb +++ b/gcc/ada/frontend.adb @@ -451,11 +451,6 @@ begin Check_Elaboration_Scenarios; - -- Remove any ignored Ghost code as it must not appear in the - -- executable. - - Remove_Ignored_Ghost_Code; - -- Examine all top level scenarios collected during analysis and -- resolution in order to diagnose conditional ABEs, even in the -- presence of serious errors. @@ -483,6 +478,14 @@ begin Sem_Warn.Output_Unreferenced_Messages; Sem_Warn.Check_Unused_Withs; Sem_Warn.Output_Unused_Warnings_Off_Warnings; + + -- Remove any ignored Ghost code as it must not appear in the + -- executable. This action must be performed last because it + -- heavily alters the tree. + + if Operating_Mode = Generate_Code or else GNATprove_Mode then + Remove_Ignored_Ghost_Code; + end if; end if; end if; end; |