public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Marek Polacek <polacek@redhat.com>
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 09:49:15 -0600	[thread overview]
Message-ID: <20220308154915.GP614@gate.crashing.org> (raw)
In-Reply-To: <Yid1eSVXIJEPMUsM@redhat.com>

On Tue, Mar 08, 2022 at 10:25:45AM -0500, Marek Polacek wrote:
> On Tue, Mar 08, 2022 at 09:14:56AM -0600, Segher Boessenkool wrote:
> > On Tue, Mar 08, 2022 at 10:08:25AM -0500, Marek Polacek wrote:
> > > ...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.

So where did *that* come from?  This isn't correct RTL.

> > You can do similar in copy_insn_1?
> 
> You mean copy_rtx?  It already has the same XVEC (orig, i) != NULL check.

No, I mean do similar in copy_insn_1 as what copy_rtx already
(correctly) does.

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

An rtvec should never have length 0.  Look at gen_rtvec for another
example.

You can get rid of the crash, sure.  But it is a much better plan to try
and get rid of the actual problem!  (And then add some more checking to
make sure this doesn't happen in the future.)


Segher

  reply	other threads:[~2022-03-08 15:50 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
2022-03-08 15:49         ` Segher Boessenkool [this message]
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=20220308154915.GP614@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.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).