------- Comment #5 from ubizjak at gmail dot com  2010-03-26 11:22 -------
(In reply to comment #4)
> > There is a mismatch in a guard expression.  Following patch fixes ICE for me
> > (I'm not sure if it makes any sense, though):
> 
> No, it isn't correct, because:
> 
> /* Return 1 if T is an INTEGER_CST that can be manipulated efficiently on
>    the host.  If POS is zero, the value can be represented in a single
>    HOST_WIDE_INT.  If POS is nonzero, the value must be non-negative and can
>    be represented in a single unsigned HOST_WIDE_INT.  */
> 
> int
> host_integerp (const_tree t, int pos)
> 
> 
> If you pass 1 to host_integerp/tree_low_cst, you must use unsigned HWI.

If this is indeed required for tree_low_cst (which is defined as signed HWI!),
then the patch that reverses the semantics of my previous patch works as well.

Index: stor-layout.c
===================================================================
--- stor-layout.c       (revision 157742)
+++ stor-layout.c       (working copy)
@@ -1349,9 +1349,9 @@ place_field (record_layout_info rli, tre
              && host_integerp (TYPE_SIZE (TREE_TYPE (field)), 0)
              && host_integerp (DECL_SIZE (field), 0))
            {
-             HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 1);
+             HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 0);
              HOST_WIDE_INT typesize
-               = tree_low_cst (TYPE_SIZE (TREE_TYPE (field)), 1);
+               = tree_low_cst (TYPE_SIZE (TREE_TYPE (field)), 0);

              if (typesize < bitsize)
                rli->remaining_in_alignment = 0;


-- 


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

Reply via email to