diff mbox series

[Ada] Fix support for prefixed call with incomplete type declarations

Message ID 20211109094540.GA829977@adacore.com
State New
Headers show
Series [Ada] Fix support for prefixed call with incomplete type declarations | expand

Commit Message

Pierre-Marie de Rodat Nov. 9, 2021, 9:45 a.m. UTC
GNAT crashes when using -gnatX on code with an incomplete type
declaration, due to a missing initialization of the list meant to store
primitive operations. Now fixed.

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

gcc/ada/

	* sem_ch3.adb (Analyze_Incomplete_Type_Decl): Add the missing
	initialization.
diff mbox series

Patch

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3506,6 +3506,15 @@  package body Sem_Ch3 is
          Set_Is_Tagged_Type (T, True);
          Set_No_Tagged_Streams_Pragma (T, No_Tagged_Streams);
          Make_Class_Wide_Type (T);
+      end if;
+
+      --  For tagged types, or when prefixed-call syntax is allowed for
+      --  untagged types, initialize the list of primitive operations to
+      --  an empty list.
+
+      if Tagged_Present (N)
+        or else Extensions_Allowed
+      then
          Set_Direct_Primitive_Operations (T, New_Elmt_List);
       end if;