[Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case

dnovillo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 21 00:53:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245

Diego Novillo <dnovillo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu.org

--- Comment #4 from Diego Novillo <dnovillo at gcc dot gnu.org> 2012-11-21 00:52:57 UTC ---
David's analysis is correct.  The type of the element at the point of the
failure is not a complete type.

At this point, I think all the types should've been completed, so I'm not sure
why this one still isn't.  Jason, this patchlet (which is very likely papering
over the issue) allows the file to build.

Index: gimplify.c
===================================================================
--- gimplify.c  (revision 193508)
+++ gimplify.c  (working copy)
@@ -2123,6 +2123,8 @@
          if (TREE_OPERAND (t, 3) == NULL_TREE)
            { 
              tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0)));
+             if (!COMPLETE_TYPE_P (elmt_type))
+               layout_type (elmt_type);
              tree elmt_size = unshare_expr (array_ref_element_size (t));
              tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type));

In this case, we have

t ==> mosaic_position[tri]
elmt_type ==> struct Vector2_f[3], but we cannot compute its element size
because it has not yet been laid out.

Jason, what would be a better place to make sure the type is laid out?


Thanks.  Diego.



More information about the Gcc-bugs mailing list