This patch avoids the frontend crash when generated with assertions
enabled and it process the following wrong sources in which partial
view is not a synchronized tagged type as requested by RM 7.3 (7.2/2).
package RT is
type I is protected interface;
type T is tagged limited private;
private
protected type T is new I with -- ERROR
end T;
end RT;
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-01 Javier Miranda <[email protected]>
* sem_util.adb (Abstract_Interface_List): Complete condition when
processing private type declarations to avoid reading unavailable
attribute.
(Is_Synchronized_Tagged_Type): Complete condition when processing
private extension declaration nodes to avoid reading unavailable
attribute.
Index: sem_util.adb
===================================================================
--- sem_util.adb (revision 177035)
+++ sem_util.adb (working copy)
@@ -165,7 +165,10 @@
Nod := Type_Definition (Parent (Typ));
elsif Nkind (Parent (Typ)) = N_Private_Type_Declaration then
- if Present (Full_View (Typ)) then
+ if Present (Full_View (Typ))
+ and then Nkind (Parent (Full_View (Typ)))
+ = N_Full_Type_Declaration
+ then
Nod := Type_Definition (Parent (Full_View (Typ)));
-- If the full-view is not available we cannot do anything else
@@ -7335,6 +7338,7 @@
and then Is_Synchronized_Interface (E))
or else
(Ekind (E) = E_Record_Type_With_Private
+ and then Nkind (Parent (E)) = N_Private_Extension_Declaration
and then (Synchronized_Present (Parent (E))
or else Is_Synchronized_Interface (Etype (E))));
end Is_Synchronized_Tagged_Type;