diff mbox series

[Ada] Fix internal error on mix of controlled and protected types

Message ID 20220516084306.GA3843544@adacore.com
State New
Headers show
Series [Ada] Fix internal error on mix of controlled and protected types | expand

Commit Message

Pierre-Marie de Rodat May 16, 2022, 8:43 a.m. UTC
The key is that the protected type is a (limited) private type, which
fools a test in Cleanup_Scopes.

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

gcc/ada/

	* inline.adb (Cleanup_Scopes): Test the underlying type.
diff mbox series

Patch

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -2773,7 +2773,7 @@  package body Inline is
             Scop := Protected_Body_Subprogram (Scop);
 
          elsif Is_Subprogram (Scop)
-           and then Is_Protected_Type (Scope (Scop))
+           and then Is_Protected_Type (Underlying_Type (Scope (Scop)))
            and then Present (Protected_Body_Subprogram (Scop))
          then
             --  If a protected operation contains an instance, its cleanup