[Sorry for responding to such an old patch]

Jakub Jelinek <ja...@redhat.com> writes:
> +/* For two FIELD_DECLs in the same chain, return -1 if field1
> +   comes before field2, 1 if field1 comes after field2 and
> +   0 if field1 == field2.  */
> +
> +static int
> +field_decl_cmp (tree field1, tree field2)
> +{
> +  if (field1 == field2)
> +    return 0;
> +
> +  tree bitpos1 = bit_position (field1);
> +  tree bitpos2 = bit_position (field2);
> +  if (tree_int_cst_equal (bitpos1, bitpos2))
> +    {
> +      /* If one of the fields has non-zero bitsize, then that
> +      field must be the last one in a sequence of zero
> +      sized fields, fields after it will have bigger
> +      bit_position.  */
> +      if (TREE_TYPE (field1) != error_mark_node
> +       && COMPLETE_TYPE_P (TREE_TYPE (field1))
> +       && integer_nonzerop (TREE_TYPE (field1)))
> +     return 1;
> +      if (TREE_TYPE (field2) != error_mark_node
> +       && COMPLETE_TYPE_P (TREE_TYPE (field2))
> +       && integer_nonzerop (TREE_TYPE (field2)))
> +     return -1;

Looks like these integer_nonzerop should be testing TYPE_SIZE or
TYPE_SIZE_UNIT -- not sure which is preferred here.

Thanks,
Richard

Reply via email to