public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference
@ 2012-01-23  7:26 jakub at gcc dot gnu.org
  2012-01-23  7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51957
           Summary: [4.7 Regression] ppc64 .debug_loc toc reference
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: amodra@gcc.gnu.org
            Target: powerpc64-linux


powerpc64-linux fails to profiledbootstrap due to .toc section reference from
cp/parser.o's .debug_loc section.

Delta reduced testcase:

int v[128];
union R { int c; union R *p; };
extern union R *w[];
typedef struct { int t; } T;
typedef struct { void *u; } U;
union R *fn1 (void);
void fn2 (int, const char *, union R *);
void fn3 (void);
int fn4 (union R *);
void
foo (U *x)
{
  T *a = x->u;
  while (1)
    {
      union R *b;
      b = fn1 ();
      {
        if (b != w[0] && !(v[b->p->c] == 1))
          {
            fn2 (a->t, "foobar", b->p);
            b = w[0];
          }
        if (b != w[0])
          fn3 ();
      }
      if (w[0] && b != w[0])
        fn4 (b->p);
      if (b != w[0] && (v[b->p->c] == 1) && fn4 (b->p))
        break;
    }
}


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
@ 2012-01-23  7:53 ` jakub at gcc dot gnu.org
  2012-01-23  8:19 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.7.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
  2012-01-23  7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
@ 2012-01-23  8:19 ` jakub at gcc dot gnu.org
  2012-01-23 10:53 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 07:25:19 UTC ---
Compile with -m64 -g -O2 -fprofile-generate (*.gcda file missing), look for
DW_OP_deref in .debug_loc section.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
  2012-01-23  7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
  2012-01-23  8:19 ` jakub at gcc dot gnu.org
@ 2012-01-23 10:53 ` jakub at gcc dot gnu.org
  2012-01-23 10:54 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 10:48:05 UTC ---
The problem is that during var-tracking adjust_insn doesn't
avoid_constant_pool_reference because we have:
(debug_insn 116 33 34 5 (var_location:DI D#3 (reg:DI 2 2)) -1
     (nil))
...
(debug_insn 114 37 113 5 (var_location:DI D#2 (mem/u/c:DI (plus:DI
(debug_expr:DI D#3)
            (const:DI (unspec:DI [
                        (symbol_ref/u:DI ("*.LC0") [flags 0x2])
                    ] UNSPEC_TOCREL))) [8 S8 A8])) -1
     (nil))
and thus rs6000_delegitimize_address doesn't do anything (as there is
DEBUG_EXPR not REG 2 directly).  This means the UNSPEC_TOCREL stuff gets down
into mem_loc_descriptor (with (reg:DI 2) in it).  There it is successfully
delegitimized and we do:
    case MEM:
      {
        rtx new_rtl = avoid_constant_pool_reference (rtl);
        if (new_rtl != rtl)
          {
            mem_loc_result = mem_loc_descriptor (new_rtl, mode, mem_mode,
                                                 initialized);
            if (mem_loc_result != NULL)
              return mem_loc_result;
          }
      }
      mem_loc_result = mem_loc_descriptor (XEXP (rtl, 0),
                                           get_address_mode (rtl), mode,
                                           VAR_INIT_STATUS_INITIALIZED);
While mem_loc_descriptor here (unlike loc_descriptor or some other places)
tries
avoid_constant_pool_reference first, mem_loc_descriptor for that fails (because
(symbol_ref "w") is external and so it falls back to DW_OP_deref on the .LC0
symbol (but that is apparently what ppc64 ld doesn't like).  On other targets,
trying to fallback to the original mem can be a win, if say we end up
dereferencing some word in .got and the linker is fine with it, we can provide
the value to the debugger.

So I'd say that ppc64 should have some target hook that would say that (at
least certain kind of) mem/u/c (on ppc64 if we can limit them to .toc section
references if possible) should never be referenced in the
.debug_info/.debug_loc (or could it be on the symbol_ref's only, can we from
the symbol_ref find out that it is a symbol from .toc section?).

Alan, what do you think about this?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-01-23 10:53 ` jakub at gcc dot gnu.org
@ 2012-01-23 10:54 ` jakub at gcc dot gnu.org
  2012-01-23 14:05 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 10:51:39 UTC ---
To reject just .toc related SYMBOL_REFs, guess we'd need to set
#define SYMBOL_FLAG_TOC_SECTION (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
or so flag on the symbol refs when creating them and test it in the target
hook.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-01-23 10:54 ` jakub at gcc dot gnu.org
@ 2012-01-23 14:05 ` jakub at gcc dot gnu.org
  2012-01-24  8:00 ` jakub at gcc dot gnu.org
  2012-01-24  8:05 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-23 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-01-23
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-23 13:51:44 UTC ---
Created attachment 26428
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26428
gcc47-pr51957.patch

Untested fix.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-01-23 14:05 ` jakub at gcc dot gnu.org
@ 2012-01-24  8:00 ` jakub at gcc dot gnu.org
  2012-01-24  8:05 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-24  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-24 07:24:44 UTC ---
Author: jakub
Date: Tue Jan 24 07:24:34 2012
New Revision: 183468

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183468
Log:
    PR target/51957
    * target.def (const_not_ok_for_debug_p): New hook.
    * doc/tm.texi.in (TARGET_CONST_NOT_OK_FOR_DEBUG_P): New hook
    documentation.
    * doc/tm.texi: Regenerated.
    * dwarf2out.c (const_ok_for_output_1): If
    targetm.const_not_ok_for_debug_p returns true, fail.
    * config/rs6000/rs6000.c (rs6000_const_not_ok_for_debug_p): New
    function.
    (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Redefine.

    * gcc.dg/pr51957-1.c: New test.
    * gcc.dg/pr51957-1.h: New file.
    * gcc.dg/pr51957-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr51957-1.c
    trunk/gcc/testsuite/gcc.dg/pr51957-1.h
    trunk/gcc/testsuite/gcc.dg/pr51957-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/doc/tm.texi
    trunk/gcc/doc/tm.texi.in
    trunk/gcc/dwarf2out.c
    trunk/gcc/target.def
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/51957] [4.7 Regression] ppc64 .debug_loc toc reference
  2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-01-24  8:00 ` jakub at gcc dot gnu.org
@ 2012-01-24  8:05 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-24  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-24 07:49:57 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-24  7:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-23  7:26 [Bug target/51957] New: [4.7 Regression] ppc64 .debug_loc toc reference jakub at gcc dot gnu.org
2012-01-23  7:53 ` [Bug target/51957] " jakub at gcc dot gnu.org
2012-01-23  8:19 ` jakub at gcc dot gnu.org
2012-01-23 10:53 ` jakub at gcc dot gnu.org
2012-01-23 10:54 ` jakub at gcc dot gnu.org
2012-01-23 14:05 ` jakub at gcc dot gnu.org
2012-01-24  8:00 ` jakub at gcc dot gnu.org
2012-01-24  8:05 ` 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).