* [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32
@ 2012-11-29 12:03 Kai Tietz
2012-11-29 12:24 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Kai Tietz @ 2012-11-29 12:03 UTC (permalink / raw)
To: GCC Patches; +Cc: Jason Merrill
Hello,
this trivial patch fixes a bootstrap issue on LLP64 hosts.
cp/
PR target/53912
* class.c (dump_class_hierarchy_r): Cast from pointer via uintptr_t.
(dump_vtable): Likewise.
Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_64-unknown-gnu-linux. Ok for apply?
Regards,
Kai
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");
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32
2012-11-29 12:03 [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32 Kai Tietz
@ 2012-11-29 12:24 ` Pedro Alves
2012-11-29 12:45 ` Kai Tietz
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2012-11-29 12:24 UTC (permalink / raw)
To: Kai Tietz; +Cc: GCC Patches, Jason Merrill
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32
2012-11-29 12:24 ` Pedro Alves
@ 2012-11-29 12:45 ` Kai Tietz
2012-11-29 12:49 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Kai Tietz @ 2012-11-29 12:45 UTC (permalink / raw)
To: Pedro Alves; +Cc: GCC Patches, Jason Merrill
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32
2012-11-29 12:45 ` Kai Tietz
@ 2012-11-29 12:49 ` Pedro Alves
2012-11-29 13:15 ` Kai Tietz
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2012-11-29 12:49 UTC (permalink / raw)
To: Kai Tietz; +Cc: GCC Patches, Jason Merrill
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?
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32
2012-11-29 12:49 ` Pedro Alves
@ 2012-11-29 13:15 ` Kai Tietz
2012-11-29 15:21 ` Jason Merrill
0 siblings, 1 reply; 6+ messages in thread
From: Kai Tietz @ 2012-11-29 13:15 UTC (permalink / raw)
To: Pedro Alves; +Cc: GCC Patches, Jason Merrill
Ok, here is the tested adjusted version using (u)intptr_t and hwi. Ok
for apply?
Kai
Index: cp/class.c
===================================================================
--- cp/class.c (Revision 193925)
+++ cp/class.c (Arbeitskopie)
@@ -7815,9 +7815,9 @@ dump_class_hierarchy_r (FILE *stream,
int i;
indented = maybe_indent_hierarchy (stream, indent, 0);
- fprintf (stream, "%s (0x%lx) ",
+ fprintf (stream, "%s (0x" HOST_WIDE_INT_PRINT_HEX ") ",
type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER),
- (unsigned long) binfo);
+ (HOST_WIDE_INT) (uintptr_t) binfo);
if (binfo != igo)
{
fprintf (stream, "alternative-path\n");
@@ -7839,10 +7839,10 @@ dump_class_hierarchy_r (FILE *stream,
if (BINFO_PRIMARY_P (binfo))
{
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
- fprintf (stream, " primary-for %s (0x%lx)",
+ fprintf (stream, " primary-for %s (0x" HOST_WIDE_INT_PRINT_HEX ")",
type_as_string (BINFO_TYPE (BINFO_INHERITANCE_CHAIN (binfo)),
TFF_PLAIN_IDENTIFIER),
- (unsigned long)BINFO_INHERITANCE_CHAIN (binfo));
+ (HOST_WIDE_INT) (uintptr_t) BINFO_INHERITANCE_CHAIN (binfo));
}
if (BINFO_LOST_PRIMARY_P (binfo))
{
if (ctor_vtbl_p)
{
if (!BINFO_VIRTUAL_P (binfo))
- fprintf (stream, " (0x%lx instance)", (unsigned long)binfo);
+ fprintf (stream, " (0x" HOST_WIDE_INT_PRINT_HEX " instance)",
+ (HOST_WIDE_INT) (uintptr_t) binfo);
fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER));
}
fprintf (stream, "\n");
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-29 15:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-29 12:03 [patch c++]: 1 of 7 Fix for PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32 Kai Tietz
2012-11-29 12:24 ` Pedro Alves
2012-11-29 12:45 ` Kai Tietz
2012-11-29 12:49 ` Pedro Alves
2012-11-29 13:15 ` Kai Tietz
2012-11-29 15:21 ` Jason Merrill
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).