public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Jakub Jelinek <jakub@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] rtl: ICE with thread_local and inline asm  [PR104777]
Date: Tue, 8 Mar 2022 10:25:45 -0500	[thread overview]
Message-ID: <Yid1eSVXIJEPMUsM@redhat.com> (raw)
In-Reply-To: <20220308151456.GO614@gate.crashing.org>

On Tue, Mar 08, 2022 at 09:14:56AM -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Tue, Mar 08, 2022 at 10:08:25AM -0500, Marek Polacek wrote:
> > On Mon, Mar 07, 2022 at 07:19:09PM -0600, Segher Boessenkool wrote:
> > > On Mon, Mar 07, 2022 at 07:03:17PM -0500, Marek Polacek via Gcc-patches wrote:
> > > > In r270550, Jakub fixed classify_insn to handle asm goto: if the asm can
> > > > jump to a label, the insn should be a JUMP_INSN.
> > > > 
> > > > However, as the following testcase shows, non-null ASM_OPERANDS_LABEL_VEC
> > > > doesn't guarantee that the rtx has any actual labels it can branch to.
> > > 
> > > But it should.
> > 
> > Ok, that would make sense.  However...
> >  
> > > > Here, the rtvec has 0 elements because of the __thread variable: we perform
> > > > ix86_rewrite_tls_address which calls copy_isns and that allocates the rtvec:
> > > > 
> > > >     XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
> > > 
> > > So fix *that* instead?  Everywhere else does not use length zero RTL
> > > vectors.  copy_rtx makes sure to do the right thing here, for example.
> > 
> > ...I don't see that.  In fact copy_rtx does the same thing as
> > copy_insn:
> > 
> >        case 'V':
> >          if (XVEC (orig, i) != NULL)
> >            {
> >              XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
> > 
> > which will copy a zero-length vector too, right?
> 
> It doesn't.  It copies NULL as NULL.  That is what that "if" is for.

But XVEC (orig, i) is not null, it just has XVECLEN 0.

> You can do similar in copy_insn_1?

You mean copy_rtx?  It already has the same XVEC (orig, i) != NULL check.

But like I said above, even if we didn't copy these XVECLEN 0 rtvecs,
the crash would not go away.

Marek


  reply	other threads:[~2022-03-08 15:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  0:03 Marek Polacek
2022-03-08  1:19 ` Segher Boessenkool
2022-03-08 15:08   ` Marek Polacek
2022-03-08 15:14     ` Segher Boessenkool
2022-03-08 15:25       ` Marek Polacek [this message]
2022-03-08 15:49         ` Segher Boessenkool
2022-03-08 16:09           ` Marek Polacek
2022-03-08 16:12           ` Jakub Jelinek
2022-03-08 16:18             ` Marek Polacek
2022-03-08 16:24             ` Segher Boessenkool
2022-03-08 16:33               ` [PATCH v2] " Marek Polacek
2022-03-08 16:40                 ` Jakub Jelinek

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=Yid1eSVXIJEPMUsM@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=segher@kernel.crashing.org \
    /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).