From 0ad7e054218ed4a8df8843a96bf59e2c8c4b4f9b Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard@codesourcery.com>
Date: Thu, 13 Sep 2007 12:27:00 +0000
Subject: [PATCH] c-parser.c (c_parser_struct_declaration): Check for a null
 return.

gcc/
	* c-parser.c (c_parser_struct_declaration): Check for a null return.

From-SVN: r128459
---
 gcc/ChangeLog  | 4 ++++
 gcc/c-parser.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e2032f23d971..c9facbd57bbe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2007-09-13  Richard Sandiford  <richard@codesourcery.com>
+
+	* c-parser.c (c_parser_struct_declaration): Check for a null return.
+
 2007-09-13  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
 	PR driver/33309
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 4bbc39d32d8e..91ba8500cb3d 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -2033,7 +2033,8 @@ c_parser_struct_declaration (c_parser *parser)
 	  tree attrs = NULL;
 	  ret = grokfield (build_id_declarator (NULL_TREE), specs,
 			   NULL_TREE, &attrs);
-	  decl_attributes (&ret, attrs, 0);
+	  if (ret)
+	    decl_attributes (&ret, attrs, 0);
 	}
       return ret;
     }
-- 
GitLab