public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
	 Marek Polacek <polacek@redhat.com>,
	 gcc-patches@gcc.gnu.org
Subject: Re: [C PATCH] Fix endless loop in the C FE initializer handling (PR c/85704)
Date: Thu, 21 Mar 2019 10:13:00 -0000	[thread overview]
Message-ID: <mpt36ngsfg5.fsf@arm.com> (raw)
In-Reply-To: <20180724085756.GB17988@tucnak> (Jakub Jelinek's message of "Tue,	24 Jul 2018 10:57:56 +0200")

[Sorry for responding to such an old patch]

Jakub Jelinek <jakub@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

      parent reply	other threads:[~2019-03-21 10:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24  8:58 Jakub Jelinek
2018-07-31 10:22 ` Patch ping (Re: [C PATCH] Fix endless loop in the C FE initializer handling (PR c/85704)) Jakub Jelinek
2018-07-31 20:05 ` [C PATCH] Fix endless loop in the C FE initializer handling (PR c/85704) Joseph Myers
2018-07-31 20:09   ` Jakub Jelinek
2018-07-31 20:11     ` Joseph Myers
2019-03-21 10:13 ` Richard Sandiford [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mpt36ngsfg5.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).