-fdump-go-spec: don't crash if DECL_ORIGINAL_TYPE is NULL

* godump.c (go_output_typedef): If DECL_ORIGINAL_TYPE is NULL, use
	TREE_TYPE.
This commit is contained in:
Ian Lance Taylor 2020-12-21 16:21:24 -08:00
parent 03ea48ff27
commit 30b76d9059

View file

@ -1159,6 +1159,8 @@ go_output_typedef (class godump_container *container, tree decl)
type = IDENTIFIER_POINTER (DECL_NAME (decl));
original_type = DECL_ORIGINAL_TYPE (decl);
if (original_type == NULL_TREE)
original_type = TREE_TYPE (decl);
/* Suppress typedefs where the type name matches the underlying
struct/union/enum tag. This way we'll emit the struct definition