public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/54256] New: IPA-SRA debug info issues
@ 2012-08-14 15:00 jakub at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: jakub at gcc dot gnu.org @ 2012-08-14 15:00 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-14 15:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 15:00 [Bug debug/54256] New: IPA-SRA debug info issues jakub at gcc dot gnu.org

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).