This patch to -fdump-go-spec code handles the case where
DECL_ORIGINAL_TYPE of a decl is NULL.  I saw this case while building
on aarch64-unknown-linux-gnu for the type pthread_attr_t.  I don't
know whether this is supposed to be possible or not, but this patch
does enable the build to continue working.  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu, and bootstrapped on
aarch64-unknown-linux-gnu.  Committed to mainline.

Ian

* godump.c (go_output_typedef): If DECL_ORIGINAL_TYPE is NULL, use
TREE_TYPE.
diff --git a/gcc/godump.c b/gcc/godump.c
index ff3a4a9c52c..a59f9a02b5f 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -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

Reply via email to