qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] exec.c:283: warning: cast from pointer to integer of different size
@ 2008-06-23  6:28 Jan Kiszka
  2008-06-23  6:39 ` Laurent Desnogues
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2008-06-23  6:28 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

Hi Paul,

trying to get rid of some of the various compiler warnings, specifically
on 64-bit hosts, I came across this:

> #if defined(CONFIG_USER_ONLY)
>         unsigned long addr;
>         size_t len = sizeof(PageDesc) * L2_SIZE;
>         /* Don't use qemu_malloc because it may recurse.  */
>         p = mmap(0, len, PROT_READ | PROT_WRITE,
>                  MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>         *lp = p;
>         addr = h2g(p);
>         if (addr == (target_ulong)addr) {
>             page_set_flags(addr & TARGET_PAGE_MASK,
>                            TARGET_PAGE_ALIGN(addr + len),
>                            PAGE_RESERVED); 
>         }
> #else

Something is fishy here. h2g already returns target_ulong (and generates
compiler warnings at this chance), but the succeeding line seems to
assume that addr can still be larger than that. Now I wonder what this
code is actually supposed to do.

Jan




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

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

* Re: [Qemu-devel] exec.c:283: warning: cast from pointer to integer of different size
  2008-06-23  6:28 [Qemu-devel] exec.c:283: warning: cast from pointer to integer of different size Jan Kiszka
@ 2008-06-23  6:39 ` Laurent Desnogues
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Desnogues @ 2008-06-23  6:39 UTC (permalink / raw)
  To: qemu-devel

On Mon, Jun 23, 2008 at 8:28 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
> Hi Paul,
>
> trying to get rid of some of the various compiler warnings, specifically
> on 64-bit hosts, I came across this:
>
>> #if defined(CONFIG_USER_ONLY)
>>         unsigned long addr;
>>         size_t len = sizeof(PageDesc) * L2_SIZE;
>>         /* Don't use qemu_malloc because it may recurse.  */
>>         p = mmap(0, len, PROT_READ | PROT_WRITE,
>>                  MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>>         *lp = p;
>>         addr = h2g(p);
>>         if (addr == (target_ulong)addr) {
>>             page_set_flags(addr & TARGET_PAGE_MASK,
>>                            TARGET_PAGE_ALIGN(addr + len),
>>                            PAGE_RESERVED);
>>         }
>> #else
>
> Something is fishy here. h2g already returns target_ulong (and generates
> compiler warnings at this chance), but the succeeding line seems to
> assume that addr can still be larger than that. Now I wonder what this
> code is actually supposed to do.

I already reported this two weeks ago and got no feedback.

http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00324.html


Laurent

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

end of thread, other threads:[~2008-06-23  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23  6:28 [Qemu-devel] exec.c:283: warning: cast from pointer to integer of different size Jan Kiszka
2008-06-23  6:39 ` Laurent Desnogues

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 NNTP newsgroup(s).