Message ID | CAEwic4YFOVyfQ8r-gsKTGMxOBEjKUSkTRx4phY6UPPgHOFCK4w@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 11/29/2012 12:03 PM, Kai Tietz wrote: > Hello, > > this trivial patch fixes a bootstrap issue on LLP64 hosts. But it's trivial at the expense of truncating the pointer. Looking around, I'd think that something like casting to hwi (after uintptr_t), and then use HOST_WIDE_INT_PRINT_HEX as format would be the gcc way. > Index: cp/class.c > =================================================================== > --- cp/class.c (Revision 193925) > +++ cp/class.c (Arbeitskopie) > @@ -7817,7 +7817,7 @@ dump_class_hierarchy_r (FILE *stream, > indented = maybe_indent_hierarchy (stream, indent, 0); > fprintf (stream, "%s (0x%lx) ", > type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER), > - (unsigned long) binfo); > + (unsigned long) (uintptr_t) binfo);
2012/11/29 Pedro Alves <palves@redhat.com>: > On 11/29/2012 12:03 PM, Kai Tietz wrote: >> Hello, >> >> this trivial patch fixes a bootstrap issue on LLP64 hosts. > > But it's trivial at the expense of truncating the pointer. > Looking around, I'd think that something like casting to hwi (after uintptr_t), > and then use HOST_WIDE_INT_PRINT_HEX as format would be the gcc way. > >> Index: cp/class.c >> =================================================================== >> --- cp/class.c (Revision 193925) >> +++ cp/class.c (Arbeitskopie) >> @@ -7817,7 +7817,7 @@ dump_class_hierarchy_r (FILE *stream, >> indented = maybe_indent_hierarchy (stream, indent, 0); >> fprintf (stream, "%s (0x%lx) ", >> type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER), >> - (unsigned long) binfo); >> + (unsigned long) (uintptr_t) binfo); > > -- > Pedro Alves Well, hwi format is of course the way to display pointer complete. On the other hand are in most cases lower 32-bit sufficent on debug-output. Kai
On 11/29/2012 12:45 PM, Kai Tietz wrote: > 2012/11/29 Pedro Alves <palves@redhat.com>: >> On 11/29/2012 12:03 PM, Kai Tietz wrote: >>> Hello, >>> >>> this trivial patch fixes a bootstrap issue on LLP64 hosts. >> >> But it's trivial at the expense of truncating the pointer. >> Looking around, I'd think that something like casting to hwi (after uintptr_t), >> and then use HOST_WIDE_INT_PRINT_HEX as format would be the gcc way. >> >>> Index: cp/class.c >>> =================================================================== >>> --- cp/class.c (Revision 193925) >>> +++ cp/class.c (Arbeitskopie) >>> @@ -7817,7 +7817,7 @@ dump_class_hierarchy_r (FILE *stream, >>> indented = maybe_indent_hierarchy (stream, indent, 0); >>> fprintf (stream, "%s (0x%lx) ", >>> type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER), >>> - (unsigned long) binfo); >>> + (unsigned long) (uintptr_t) binfo); >> > Well, hwi format is of course the way to display pointer complete. On > the other hand are in most cases lower 32-bit sufficent on > debug-output. But what's the point of not making it complete? It's not like we're talking about a large amount of work to get it right. It should be a two-line patch?
Index: cp/class.c =================================================================== --- cp/class.c (Revision 193925) +++ cp/class.c (Arbeitskopie) @@ -7817,7 +7817,7 @@ dump_class_hierarchy_r (FILE *stream, indented = maybe_indent_hierarchy (stream, indent, 0); fprintf (stream, "%s (0x%lx) ", type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER), - (unsigned long) binfo); + (unsigned long) (uintptr_t) binfo); if (binfo != igo) { fprintf (stream, "alternative-path\n"); @@ -7842,7 +7842,7 @@ dump_class_hierarchy_r (FILE *stream, fprintf (stream, " primary-for %s (0x%lx)", type_as_string (BINFO_TYPE (BINFO_INHERITANCE_CHAIN (binfo)), TFF_PLAIN_IDENTIFIER), - (unsigned long)BINFO_INHERITANCE_CHAIN (binfo)); + (unsigned long) (uintptr_t) BINFO_INHERITANCE_CHAIN (binfo)); } if (BINFO_LOST_PRIMARY_P (binfo)) { @@ -7975,7 +7975,8 @@ dump_vtable (tree t, tree binfo, tree vtable) if (ctor_vtbl_p) { if (!BINFO_VIRTUAL_P (binfo)) - fprintf (stream, " (0x%lx instance)", (unsigned long)binfo); + fprintf (stream, " (0x%lx instance)", (unsigned long) + (uintptr_t) binfo); fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER)); } fprintf (stream, "\n");