diff mbox series

[Ada] Return raise with access class-wide interface

Message ID 20170907100927.GA69543@adacore.com
State New
Headers show
Series [Ada] Return raise with access class-wide interface | expand

Commit Message

Arnaud Charlet Sept. 7, 2017, 10:09 a.m. UTC
This patches fixes a bug in which a function returns an anonymous access
type whose designated type is a class-wide interface type, and the
return statement returns a raise expression, the compiler crashes.

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

2017-09-07  Bob Duff  <duff@adacore.com>

	* sem_ch6.adb (Analyze_Function_Return): Do not
	insert an explicit conversion to force the displacement of the
	"this" pointer to reference the secondary dispatch table in the
	case where the return statement is returning a raise expression,
	as in "return raise ...".
diff mbox series

Patch

Index: sem_ch6.adb
===================================================================
--- sem_ch6.adb	(revision 251835)
+++ sem_ch6.adb	(working copy)
@@ -910,7 +910,7 @@ 
             if Expander_Active
               and then Serious_Errors_Detected = 0
               and then Is_Access_Type (R_Type)
-              and then Nkind (Expr) /= N_Null
+              and then not Nkind_In (Expr, N_Null, N_Raise_Expression)
               and then Is_Interface (Designated_Type (R_Type))
               and then Is_Progenitor (Designated_Type (R_Type),
                                       Designated_Type (Etype (Expr)))