* [Ada] Return raise with access class-wide interface
@ 2017-09-07 10:09 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-09-07 10:09 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 573 bytes --]
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 ...".
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 623 bytes --]
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)))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-07 10:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 10:09 [Ada] Return raise with access class-wide interface Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).