qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Avoid compiler error
@ 2010-04-10  7:26 Stefan Weil
  2010-04-10 15:15 ` [Qemu-devel] " Aurelien Jarno
  2010-04-10 18:43 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2010-04-10  7:26 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Juergen Lock, Aurelien Jarno, Richard Henderson

A 32 bit cross compilation of x86_64-linux-user raises this error:

  CC    x86_64-linux-user/exec.o
cc1: warnings being treated as errors
exec.c: In function ‘page_init’:
exec.c:350: error: large integer implicitly truncated to unsigned type

L1_MAP_ADDR_SPACE_BITS == 47, HOST_LONG_BITS == 32,
so the shift operation indeed is problematic.

Limit endaddr to ULONG_MAX in this case.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 exec.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index a6d3bad..c80b7f7 100644
--- a/exec.c
+++ b/exec.c
@@ -343,6 +343,8 @@ static void page_init(void)
                     } else {
 #if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS
                         endaddr = ~0ul;
+#elif HOST_LONG_BITS <= L1_MAP_ADDR_SPACE_BITS
+                        endaddr = ULONG_MAX;
 #else
                         endaddr = ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS) - 1;
 #endif
-- 
1.7.0

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

* [Qemu-devel] Re: [PATCH] Avoid compiler error
  2010-04-10  7:26 [Qemu-devel] [PATCH] Avoid compiler error Stefan Weil
@ 2010-04-10 15:15 ` Aurelien Jarno
  2010-04-10 18:43 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2010-04-10 15:15 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Juergen Lock, QEMU Developers, Richard Henderson

On Sat, Apr 10, 2010 at 09:26:03AM +0200, Stefan Weil wrote:
> A 32 bit cross compilation of x86_64-linux-user raises this error:
> 
>   CC    x86_64-linux-user/exec.o
> cc1: warnings being treated as errors
> exec.c: In function ‘page_init’:
> exec.c:350: error: large integer implicitly truncated to unsigned type
> 
> L1_MAP_ADDR_SPACE_BITS == 47, HOST_LONG_BITS == 32,
> so the shift operation indeed is problematic.
> 

I am not sure it is the real fix. I don't think there is a point of
having L1_MAP_ADDR_SPACE_BITS > HOST_LONG_BITS, most probably it should
be reduced to HOST_LONG_BITS if the latter is smaller, as done in system
mode.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

* [Qemu-devel] Re: [PATCH] Avoid compiler error
  2010-04-10  7:26 [Qemu-devel] [PATCH] Avoid compiler error Stefan Weil
  2010-04-10 15:15 ` [Qemu-devel] " Aurelien Jarno
@ 2010-04-10 18:43 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2010-04-10 18:43 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers, Aurelien Jarno, Juergen Lock

On 04/10/2010 12:26 AM, Stefan Weil wrote:
> A 32 bit cross compilation of x86_64-linux-user raises this error:
>                       } else {
>   #if TARGET_ABI_BITS<= L1_MAP_ADDR_SPACE_BITS
>                           endaddr = ~0ul;
> +#elif HOST_LONG_BITS<= L1_MAP_ADDR_SPACE_BITS
> +                        endaddr = ULONG_MAX;
>   #else
>                           endaddr = ((abi_ulong)1<<  L1_MAP_ADDR_SPACE_BITS) - 1;
>   #endif

You ought to merge those two ifs.  I.e.


#if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS \
     || HOST_LONG_BITS<= L1_MAP_ADDR_SPACE_BITS


r~

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

end of thread, other threads:[~2010-04-10 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-10  7:26 [Qemu-devel] [PATCH] Avoid compiler error Stefan Weil
2010-04-10 15:15 ` [Qemu-devel] " Aurelien Jarno
2010-04-10 18:43 ` Richard Henderson

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).