diff mbox

[69217] : [6 Regression] ICE at var-tracking.c:5038 Segmentation fault

Message ID CABOHX+c3dd3baBDgWRJO2AGnuGJrkMU91SETM4RHEzH4=wV78w@mail.gmail.com
State New
Headers show

Commit Message

Iain Buclaw Jan. 23, 2016, 12:45 p.m. UTC
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.

Comments

Alexandre Oliva Jan. 26, 2016, 5:15 p.m. UTC | #1
On Jan 23, 2016, Iain Buclaw <ibuclaw@gdcproject.org> wrote:

>     	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.

This looks good to me, thanks.
diff mbox

Patch

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;