public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/54256] New: IPA-SRA debug info issues
Date: Tue, 14 Aug 2012 15:00:00 -0000	[thread overview]
Message-ID: <bug-54256-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54256

             Bug #: 54256
           Summary: IPA-SRA debug info issues
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: jamborm@gcc.gnu.org, jan.kratochvil@redhat.com


struct A
{
#ifdef PAD
  void *c;
#endif
  struct A *a;
  void *b;
};

typedef int FN (struct A *);
extern void *v;
struct A *fn (void);

void
foo (FN *y, int z)
{
  struct A *x = fn ();
  baz (x, y, z);
}

static int
bar (FN *x, struct A *y, int z, int w)
{
  if (v)
    undef (8, v);
  (*x) (y->a);
}

int
baz (struct A *x, FN *y, int z)
{
  bar (y, x, z, 0);
  return 0;
}

at -g -O2 doesn't provide debug info for the foo y parameter, eventhough it
actually is passed.  The reason for that seems to be that IPA-SRA? decides to
not pass struct A *, but actually struct A ** instead (address of the a field
of a, i.e. essentially the exactly same pointer), we generate
DW_OP_GNU_parameter_ref but in the end at the call site the argument isn't
available (it is only available in the called function).
Not sure why IPA-SRA does this change (and with -DPAD it is actually a code
pessimization), supposedly because it hopes for scalarization opportunities in
the caller which at the end don't come though.

I've tried:
struct A { void *c; struct A *a; void *b; };
typedef int FN (struct A *);
extern void *v;
struct A *fn (void);

void
foo (FN *y, int z)
{
  struct A x = { fn (), 0 };
  baz (&x, y, z);
}

static int
bar (FN *x, struct A *y, int z, int w)
{
  if (v)
    undef (8, v);
  (*x) (y->a);
}

int
baz (struct A *x, FN *y, int z)
{
  bar (y, x, z, 0);
  return 0;
}

but even that isn't scalarized in the caller, so I wonder when it is actually
useful this way.


                 reply	other threads:[~2012-08-14 15:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-54256-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).