[C patch] Crash with -fdump-ada-spec on multi-dimension array params

Arnaud Charlet charlet@adacore.com
Fri Jan 21 11:33:00 GMT 2011


This is almost an "obvious" patch which fixes a crash on the
following kind of construct:

  int subp (int ranges[][33]);

when generating Ada specs with -fdump-ada-spec

Tested on x86_64-pc-linux-gnu, OK for trunk?

2011-01-21  Arnaud Charlet  <charlet@adacore.com>

	* c-ada-spec.c (dump_generic_ada_node): Avoid dereferencing null type.

--
*** gcc/c-family/c-ada-spec.c
--- gcc/c-family/c-ada-spec.c
*************** dump_generic_ada_node (pretty_printer *b
*** 2160,2165 ****
--- 2160,2166 ----
  			      || !TYPE_FIELDS (TREE_TYPE (underlying_type))))
  		      /* Pointer to opaque structure.  */
  
+ 		      || underlying_type == NULL_TREE
  		      || (!typ2
  			  && !TREE_VISITED (underlying_type)
  			  && !TREE_VISITED (type_name)



More information about the Gcc-patches mailing list