public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/46796] New: debug info missing builtin type names on darwin
@ 2010-12-03 23:33 mrs at gcc dot gnu.org
  2010-12-03 23:42 ` [Bug lto/46796] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2010-12-03 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: debug info missing builtin type names on darwin
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mrs@gcc.gnu.org


int i;

doesn't preserve the name "int" on the type under lto.  Consider:

$ cat t.c
volatile float a1, a2;

void * volatile vp;

void f(int i) {
  a1 = i;
  a1 = a2;
}

int main() {
  f(12);
  return 0;
}

$ ./xgcc -B./ -flto t.c -g -v -Wl,-debug -save-temps
$ grep int cc*.s 
$ ./xgcc -B./ -S t.c -g -o t-normal.s
$ grep int t-normal.s 
    .ascii "int\0"

because of this, this code:


  /* This probably indicates a bug.  */
  else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
    add_name_attribute (mod_type_die, "__unknown__");

in dwarf2out.c adds a name __unknown__ to most things, and under gdb, we get:

(gdb) start
(gdb) step
(gdb) ptype i
type = __unknown__

instead of:

(gdb) start
(gdb) step
(gdb) ptype i
type = int

when we compile without -flto.  If the name was preserved, then the type would
have the right name, instead of __unknown__.


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

* [Bug lto/46796] debug info missing builtin type names on darwin
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
@ 2010-12-03 23:42 ` rguenth at gcc dot gnu.org
  2010-12-03 23:45 ` mrs at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.03 23:41:59
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 23:41:59 UTC ---
Confirmed.  We merge simple types without caring for their name (and thus
end up using the LTO frontend provided common tree node types).


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

* [Bug lto/46796] debug info missing builtin type names on darwin
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
  2010-12-03 23:42 ` [Bug lto/46796] " rguenth at gcc dot gnu.org
@ 2010-12-03 23:45 ` mrs at gcc dot gnu.org
  2010-12-03 23:51 ` [Bug debug/46796] debug info missing builtin type names with lto rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2010-12-03 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2010-12-03 23:45:15 UTC ---
>From dwarfdump of the good .o file:

0x000000a1:         TAG_formal_parameter [3]  
                     AT_name( "i" )
                     AT_decl_file( "/Users/mrs/net/gcc-darwinLTO/gcc/t.c" )
                     AT_decl_line( 5 )
                     AT_type( {0x000000ae} ( int ) )
                     AT_location( fbreg -20 )

0x000000ae:     TAG_base_type [4]  
                 AT_byte_size( 0x04 )
                 AT_encoding( DW_ATE_signed )
                 AT_name( "int" )

and for the bad version:

0x00000110:         TAG_formal_parameter [5]  
                     AT_name( "i" )
                     AT_decl_file( "/Users/mrs/net/gcc-darwinLTO/gcc/t.c" )
                     AT_decl_line( 5 )
                     AT_type( {0x000000ea} ( __unknown__ ) )
                     AT_location( fbreg -20 )

0x000000ea:     TAG_base_type [3]  
                 AT_byte_size( 0x04 )
                 AT_encoding( DW_ATE_signed )
                 AT_name( "__unknown__" )


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
  2010-12-03 23:42 ` [Bug lto/46796] " rguenth at gcc dot gnu.org
  2010-12-03 23:45 ` mrs at gcc dot gnu.org
@ 2010-12-03 23:51 ` rguenth at gcc dot gnu.org
  2010-12-03 23:53 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 23:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto
                 CC|                            |rguenth at gcc dot gnu.org
          Component|lto                         |debug
            Summary|debug info missing builtin  |debug info missing builtin
                   |type names on darwin        |type names with lto

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 23:51:27 UTC ---
Sth like

Index: gimple.c
===================================================================
--- gimple.c    (revision 167445)
+++ gimple.c    (working copy)
@@ -3436,6 +3436,10 @@ gtc_visit (tree t1, tree t2, enum gtc_mo
   if (TREE_CODE (t1) == VOID_TYPE)
     return true;

+  if (mode == GTC_MERGE
+      && !compare_type_names_p (t1, t2, false))
+    return false;
+
   /* Do some simple checks before doing three hashtable queries.  */
   if (INTEGRAL_TYPE_P (t1)
       || SCALAR_FLOAT_TYPE_P (t1)
@@ -3874,6 +3878,10 @@ gimple_types_compatible_p (tree t1, tree
   if (TREE_CODE (t1) == VOID_TYPE)
     return true;

+  if (mode == GTC_MERGE
+      && !compare_type_names_p (t1, t2, false))
+    return false;
+
   /* Do some simple checks before doing three hashtable queries.  */
   if (INTEGRAL_TYPE_P (t1)
       || SCALAR_FLOAT_TYPE_P (t1)


could fix this at the cost of some memory.


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-12-03 23:51 ` [Bug debug/46796] debug info missing builtin type names with lto rguenth at gcc dot gnu.org
@ 2010-12-03 23:53 ` rguenth at gcc dot gnu.org
  2010-12-06 10:08 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 23:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 23:52:55 UTC ---
but it conflicts with the way we pre-seed the cache with our common tree nodes,
so it doesn't actually work but ICEs.


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-12-03 23:53 ` rguenth at gcc dot gnu.org
@ 2010-12-06 10:08 ` rguenth at gcc dot gnu.org
  2010-12-06 10:10 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-06 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-06 10:08:45 UTC ---
Author: rguenth
Date: Mon Dec  6 10:08:43 2010
New Revision: 167487

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167487
Log:
2010-12-06  Richard Guenther  <rguenther@suse.de>

    PR lto/46796
    * lto-lang.c (lto_init): Give names to basic types.

Modified:
    trunk/gcc/lto/ChangeLog
    trunk/gcc/lto/lto-lang.c


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2010-12-06 10:08 ` rguenth at gcc dot gnu.org
@ 2010-12-06 10:10 ` rguenth at gcc dot gnu.org
  2010-12-07 16:17 ` mrs at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-06 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-06 10:10:46 UTC ---
Somewhat mitigated for 4.6 now, a proper solution is to not do streamer cache
preloading and not merge types with different names (we do that already,
but only for aggregates right now).

I'll do this for 4.7.


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2010-12-06 10:10 ` rguenth at gcc dot gnu.org
@ 2010-12-07 16:17 ` mrs at gcc dot gnu.org
  2010-12-07 16:33 ` rguenther at suse dot de
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2010-12-07 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2010-12-07 16:17:09 UTC ---
Ok, I can confirm that ptype i is better, now, the next problem:

(gdb) ptype a1
type = volatile __unknown__

:-(


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2010-12-07 16:17 ` mrs at gcc dot gnu.org
@ 2010-12-07 16:33 ` rguenther at suse dot de
  2010-12-10 14:33 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2010-12-07 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> 2010-12-07 16:32:57 UTC ---
On Tue, 7 Dec 2010, mrs at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46796
> 
> --- Comment #7 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2010-12-07 16:17:09 UTC ---
> Ok, I can confirm that ptype i is better, now, the next problem:
> 
> (gdb) ptype a1
> type = volatile __unknown__
> 
> :-(

Yeah, I saw that but didn't yet debug why it happens.


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2010-12-07 16:33 ` rguenther at suse dot de
@ 2010-12-10 14:33 ` rguenth at gcc dot gnu.org
  2011-12-20  9:50 ` rguenth at gcc dot gnu.org
  2011-12-20 10:21 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-10 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-10 14:32:48 UTC ---
The volatile qualified case happens because dwarf2out.c wants to emit an
unqualified variant first and gets at it via get_qualified_type which in
turn uses check_qualified_type to pick one from the list of variant types.

But as we never merge TYPE_DECLs we have different TYPE_NAMEs for the
qualified and unqualified variants:

(gdb) call debug_tree ($34)
 <type_decl 0xb7758798 float
    type <real_type 0xb7750900 float asm_written SF
        size <integer_cst 0xb773f240 constant 32>
        unit size <integer_cst 0xb773f078 constant 4>
        align 32 symtab 0 alias set -1 structural equality precision 32
        pointer_to_this <pointer_type 0xb7750a20>>
    VOID file (null) line 0 col 0
    align 1>
(gdb) call debug_tree ($35)
 <type_decl 0xb775857c float
    type <real_type 0xb7750900 float asm_written SF
        size <integer_cst 0xb773f240 constant 32>
        unit size <integer_cst 0xb773f078 constant 4>
        align 32 symtab 0 alias set -1 structural equality precision 32
        pointer_to_this <pointer_type 0xb7750a20>>
    VOID file (null) line 0 col 0
    align 1>

and thus get_qualified_type happily returns NULL which leads to
name being set to NULL even though the original type does
have a name in modified_type_die.

Now.  We probably should start to merge TYPE_DECLs at some point,
even if it is only for memory use.

But instead of

  /* This probably indicates a bug.  */
  else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
    add_name_attribute (mod_type_die, "__unknown__");

we could use TYPE_NAME of the original type here, it will have no
qualifications anyway.


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2010-12-10 14:33 ` rguenth at gcc dot gnu.org
@ 2011-12-20  9:50 ` rguenth at gcc dot gnu.org
  2011-12-20 10:21 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-20  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-20 09:49:22 UTC ---
Author: rguenth
Date: Tue Dec 20 09:49:17 2011
New Revision: 182524

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182524
Log:
2011-12-20  Richard Guenther  <rguenther@suse.de>

    PR lto/46796
    * dwarf2out.c (modified_type_die): When the type variant
    chain is corrupt use the types name, if available, instead
    of __unknown__.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c


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

* [Bug debug/46796] debug info missing builtin type names with lto
  2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2011-12-20  9:50 ` rguenth at gcc dot gnu.org
@ 2011-12-20 10:21 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-20 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.6.2

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-20 09:49:53 UTC ---
Fixed on trunk.


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

end of thread, other threads:[~2011-12-20  9:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 23:33 [Bug lto/46796] New: debug info missing builtin type names on darwin mrs at gcc dot gnu.org
2010-12-03 23:42 ` [Bug lto/46796] " rguenth at gcc dot gnu.org
2010-12-03 23:45 ` mrs at gcc dot gnu.org
2010-12-03 23:51 ` [Bug debug/46796] debug info missing builtin type names with lto rguenth at gcc dot gnu.org
2010-12-03 23:53 ` rguenth at gcc dot gnu.org
2010-12-06 10:08 ` rguenth at gcc dot gnu.org
2010-12-06 10:10 ` rguenth at gcc dot gnu.org
2010-12-07 16:17 ` mrs at gcc dot gnu.org
2010-12-07 16:33 ` rguenther at suse dot de
2010-12-10 14:33 ` rguenth at gcc dot gnu.org
2011-12-20  9:50 ` rguenth at gcc dot gnu.org
2011-12-20 10:21 ` rguenth 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).