Hi,
This fixes the regression seen from a change at revision 231897.
Unfortunately I don't have any tests as it was noticed in my frontend
(D). And equivalent C/C++ doesn't trigger because:
- C set the mode of empty struct types as BLKmode.
- C++ lowered passing around empty struct types as CONSTRUCTOR expressions.
Perhaps other front-ends could trigger this, but I would not know how
to write an equivalent test for them. In any case, I hope this is an
obvious patch.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69217
Regards,
Iain.
Author: Iain Buclaw
Date: Sat Jan 23 13:42:51 2016 +0100
PR rtl-optimization/69217
* var-tracking.c (tracked_record_parameter_p): Don't segfault if there
are no TYPE_FIELDS set for the record type.
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 86183b3..de3a80b 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5128,7 +5128,8 @@ tracked_record_parameter_p (tree t)
if (TREE_CODE (type) != RECORD_TYPE)
return false;
- if (DECL_CHAIN (TYPE_FIELDS (type)) == NULL_TREE)
+ if (TYPE_FIELDS (type) == NULL_TREE
+ || DECL_CHAIN (TYPE_FIELDS (type)) == NULL_TREE)
return false;
return true;