[Ada] Fix oversight in implementation of unnesting

Message ID 20220912081925.GA1512920@poulhies-Precision-5550
State New, archived
Headers
Series [Ada] Fix oversight in implementation of unnesting |

Commit Message

Marc Poulhiès Sept. 12, 2022, 8:19 a.m. UTC
  The pass would traverse generic subprogram bodies, which are not expanded,
thus stumbling on unexpected nodes.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_unst.adb (Unnest_Subprograms.Search_Subprograms): Skip the
	subprogram bodies that are not to be unnested.
  

Patch

diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -2592,6 +2592,8 @@  package body Exp_Unst is
                  and then Is_Library_Level_Entity (Spec_Id)
                then
                   Unnest_Subprogram (Spec_Id, N);
+               else
+                  return Skip;
                end if;
             end;