diff mbox series

[Ada] Compiler crash on call to function instance

Message ID 20201214155603.GA3987@adacore.com
State New
Headers show
Series [Ada] Compiler crash on call to function instance | expand

Commit Message

Pierre-Marie de Rodat Dec. 14, 2020, 3:56 p.m. UTC
This patch fixes a bug that causes the compiler to crash if a
renaming-as-body renames a function that is an instance of a generic
function that returns a generic formal type, and the actual type is
controlled, and the instantiation is nested within a procedure.

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

gcc/ada/

	* exp_ch6.adb (Is_Build_In_Place_Result_Type): Further narrow
	the conditions under which we enable build-in-place for
	controlled types.
diff mbox series

Patch

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -8091,6 +8091,7 @@  package body Exp_Ch6 is
 
                if True then
                   Result := Is_Controlled (T)
+                    and then not Is_Generic_Actual_Type (T)
                     and then Present (Enclosing_Subprogram (T))
                     and then not Is_Compilation_Unit (Enclosing_Subprogram (T))
                     and then Ekind (Enclosing_Subprogram (T)) = E_Procedure;