diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 0ef894e153b3f27b0d05853fe72884de92393ae7..a38ab284ce7aa592c1b0029bd252543f0f3e420a 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -16526,7 +16526,7 @@ package body Sem_Ch12 is
                   E := Entity (Name (N2));
 
                   if Present (E) and then Is_Global (E) then
-                     Set_Etype (N, Etype (N2));
+                     Set_Global_Type (N, N2);
                   else
                      Set_Associated_Node (N, Empty);
                      Set_Etype (N, Empty);