Re: [PATCH] print format does not match argument type

Roland Schwingel <[email protected]> Tue, 10 Apr 2012 16:29:37 +0200
Newsgroups gmane.comp.debugging.insight
Message-ID <[email protected]>
Hi Patrick,

[email protected] wrote on 05.04.2012 18:34:27:
 > In gdb/gdbtk/generic/gdbtk-register.c, 2 statements try to use a print
 > format of "%lx" for a size_t argument. The correctness of such
 > statements is architecture dependent. If warnings are treated as
 > errors,the compilation fails.
Which warnings do you get on which platform?

The casts to size_t where introduced by myself some days ago.
Previously they where casted to long.

The TYPE_FIELD_TYPE macro returns a pointer to a struct type.
Treating this as (unsigned) long is pretty correct on *nix style
systems but not on windows. On 64bit windows a long is still 4 bytes
long, so the downcasted value is simply wrong.

Roland