This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, 69217]: [6 Regression] ICE at var-tracking.c:5038 Segmentation fault
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: jakub at gcc dot gnu dot org, ebotcazou at gcc dot gnu dot org, aoliva at gcc dot gnu dot org
- Date: Sat, 23 Jan 2016 13:45:26 +0100
- Subject: [PATCH, 69217]: [6 Regression] ICE at var-tracking.c:5038 Segmentation fault
- Authentication-results: sourceware.org; auth=none
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 <ibuclaw@gdcproject.org>
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;