diff mbox

target-alpha: Avoid gcc 6.1 werror for linux-user

Message ID 1466192793-2559-1-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson June 17, 2016, 7:46 p.m. UTC
Using gcc 6.1 for alpha-linux-user target we see the following build error:

.../target-alpha/translate.c: In function ‘in_superpage’:
.../target-alpha/translate.c:454:52: error: self-comparison always evaluates to true [-Werror=tautological-compare]
             && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);

Reported-by: Pranith Kumar <bobby.prani@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-alpha/translate.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini June 27, 2016, 6:32 p.m. UTC | #1
On 17/06/2016 21:46, Richard Henderson wrote:
> Using gcc 6.1 for alpha-linux-user target we see the following build error:
> 
> .../target-alpha/translate.c: In function ‘in_superpage’:
> .../target-alpha/translate.c:454:52: error: self-comparison always evaluates to true [-Werror=tautological-compare]
>              && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);
> 
> Reported-by: Pranith Kumar <bobby.prani@gmail.com>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target-alpha/translate.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/target-alpha/translate.c b/target-alpha/translate.c
> index f9b2426..051b4b7 100644
> --- a/target-alpha/translate.c
> +++ b/target-alpha/translate.c
> @@ -448,10 +448,13 @@ static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
>  
>  static bool in_superpage(DisasContext *ctx, int64_t addr)
>  {
> +#ifndef CONFIG_USER_ONLY
>      return ((ctx->tb->flags & TB_FLAGS_USER_MODE) == 0
> -            && addr < 0
> -            && ((addr >> 41) & 3) == 2
> -            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);
> +            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
> +            && ((addr >> 41) & 3) == 2);
> +#else
> +    return false;
> +#endif
>  }
>  
>  static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
> 

Peter, can you apply this as a build-breakage fix?  (Fedora 24 is now
out and has this bug).

Paolo
Peter Maydell June 28, 2016, 8:03 a.m. UTC | #2
On 27 June 2016 at 19:32, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 17/06/2016 21:46, Richard Henderson wrote:
>> Using gcc 6.1 for alpha-linux-user target we see the following build error:
>>
>> .../target-alpha/translate.c: In function ‘in_superpage’:
>> .../target-alpha/translate.c:454:52: error: self-comparison always evaluates to true [-Werror=tautological-compare]
>>              && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);
>>
>> Reported-by: Pranith Kumar <bobby.prani@gmail.com>
>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>> ---
>>  target-alpha/translate.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/target-alpha/translate.c b/target-alpha/translate.c
>> index f9b2426..051b4b7 100644
>> --- a/target-alpha/translate.c
>> +++ b/target-alpha/translate.c
>> @@ -448,10 +448,13 @@ static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
>>
>>  static bool in_superpage(DisasContext *ctx, int64_t addr)
>>  {
>> +#ifndef CONFIG_USER_ONLY
>>      return ((ctx->tb->flags & TB_FLAGS_USER_MODE) == 0
>> -            && addr < 0
>> -            && ((addr >> 41) & 3) == 2
>> -            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);
>> +            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
>> +            && ((addr >> 41) & 3) == 2);
>> +#else
>> +    return false;
>> +#endif
>>  }
>>
>>  static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
>>
>
> Peter, can you apply this as a build-breakage fix?  (Fedora 24 is now
> out and has this bug).

Applied to master, thanks.

-- PMM
diff mbox

Patch

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index f9b2426..051b4b7 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -448,10 +448,13 @@  static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
 
 static bool in_superpage(DisasContext *ctx, int64_t addr)
 {
+#ifndef CONFIG_USER_ONLY
     return ((ctx->tb->flags & TB_FLAGS_USER_MODE) == 0
-            && addr < 0
-            && ((addr >> 41) & 3) == 2
-            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == addr >> 63);
+            && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
+            && ((addr >> 41) & 3) == 2);
+#else
+    return false;
+#endif
 }
 
 static bool use_goto_tb(DisasContext *ctx, uint64_t dest)