diff mbox

Fix segfault on double typedef for enum with -fdump-ada-spec

Message ID 54782229.rgNBnXcqE2@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 13, 2016, 5:37 p.m. UTC
This happens with the C++ compiler only.

Tested on x86_64-suse-linux, applied on the mainline.


2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>

c-family/
	* c-ada-spec.c (print_ada_declaration): For typedef declarations, look
	for nested types only if the type is a record or union and dump SLOC.


2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>

	* c-c++-common/dump-ada-spec-6.c: New test.

-- 
Eric Botcazou
diff mbox

Patch

Index: c-ada-spec.c
===================================================================
--- c-ada-spec.c	(revision 242334)
+++ c-ada-spec.c	(working copy)
@@ -2813,7 +2813,7 @@  print_ada_declaration (pretty_printer *b
 		}
 	      else
 		{
-		  if (!TREE_VISITED (stub)
+		  if (RECORD_OR_UNION_TYPE_P (typ)
 		      && DECL_SOURCE_FILE (stub) == source_file_base)
 		    dump_nested_types (buffer, stub, stub, true, spc);
 
@@ -2821,7 +2821,8 @@  print_ada_declaration (pretty_printer *b
 		  dump_generic_ada_node (buffer, t, type, spc, false, true);
 		  pp_string (buffer, " is ");
 		  dump_generic_ada_node (buffer, typ, type, spc, false, true);
-		  pp_semicolon (buffer);
+		  pp_string (buffer, ";  -- ");
+		  dump_sloc (buffer, t);
 		}
 
 	      TREE_VISITED (t) = 1;