-fdump-go-spec: don't crash if DECL_ORIGINAL_TYPE is NULL
authorIan Lance Taylor <iant@golang.org>
Tue, 22 Dec 2020 00:21:24 +0000 (16:21 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 22 Dec 2020 00:21:58 +0000 (16:21 -0800)
* godump.c (go_output_typedef): If DECL_ORIGINAL_TYPE is NULL, use
TREE_TYPE.

gcc/godump.c

index ff3a4a9c52ce930694e7466fc7ff5a7295babc0f..a59f9a02b5fb857f7caa8a9c099626ae7c47b615 100644 (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