public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Handle undefined extern vars in output_in_order
Date: Thu, 16 Jun 2016 15:24:00 -0000	[thread overview]
Message-ID: <20160616152403.GA38925@kam.mff.cuni.cz> (raw)
In-Reply-To: <alpine.LNX.2.20.1606161733020.16817@monopod.intra.ispras.ru>

> On Thu, 16 Jun 2016, Jan Hubicka wrote:
> > > On Thu, 9 Jun 2016, Alexander Monakov wrote:
> > +  FOR_EACH_VARIABLE (pv)
> [snip]
> > +      i = pv->order;
> > +      gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
> > +      nodes[i].kind = pv->definition ? ORDER_VAR : ORDER_VAR_UNDEF;
> > +      nodes[i].u.v = pv;
> > 
> > order for undefined variables is not computed, so it will be 0. Doesn't
> > think overwrite existing entries of nodes array?
> 
> Hm, I've tried the following testcase:
> 
> extern int a, b;
> int f()
> {
>   return a+b;
> }
> 
> and in the above loop I see pv->order == 2 on the first iteration,
> pv->order == 1 on the second. Under what circumstances wouldn't
> order be computed?

I see, order is created at a time variable is added to symbol table (not at time when definition is given).
So we should have order everywhere.
Patch is OK

Honza
> 
> Thanks.
> Alexander

  reply	other threads:[~2016-06-16 15:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 13:13 Alexander Monakov
2016-06-16 13:59 ` Alexander Monakov
2016-06-16 14:25   ` Jan Hubicka
2016-06-16 14:37     ` Alexander Monakov
2016-06-16 15:24       ` Jan Hubicka [this message]
2016-06-16 15:36         ` Alexander Monakov
2016-06-16 15:42           ` Jan Hubicka
2016-06-23 14:45             ` Alexander Monakov
2016-07-01  6:58               ` Alexander Monakov
2016-07-08  7:47                 ` Alexander Monakov
2016-07-14 18:08               ` Jeff Law
2016-07-14 18:34                 ` Alexander Monakov
2016-07-14 20:28                   ` Jeff Law
2016-07-14 20:31               ` Jeff Law

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=20160616152403.GA38925@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.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).