public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Avoid FE crash processing wrong sources
@ 2011-08-01 14:38 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2011-08-01 14:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Javier Miranda

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

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  <miranda@adacore.com>

	* 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.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1072 bytes --]

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-01 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 14:38 [Ada] Avoid FE crash processing wrong sources 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).