qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pranith Kumar <bobby.prani@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	"open list:ARM" <qemu-arm@nongnu.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 5/5] target-arm: Fix warn about implicit conversion
Date: Tue,  9 Aug 2016 15:02:28 -0400	[thread overview]
Message-ID: <20160809190229.27871-5-bobby.prani@gmail.com> (raw)
In-Reply-To: <20160809190229.27871-1-bobby.prani@gmail.com>

Clang warns about an implicit conversion as follows:

/mnt/devops/code/qemu/target-arm/neon_helper.c:1075:1: warning: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 128 to -128 [-Wconstant-conversion]
NEON_VOP_ENV(qrshl_s8, neon_s8, 4)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/devops/code/qemu/target-arm/neon_helper.c:116:83: note: expanded from macro 'NEON_VOP_ENV'
uint32_t HELPER(glue(neon_,name))(CPUARMState *env, uint32_t arg1, uint32_t arg2) \
                                                                                  ^
/mnt/devops/code/qemu/target-arm/neon_helper.c:106:5: note: expanded from macro '\
NEON_VOP_BODY'
    NEON_DO##n; \
    ^~~~~~~~~~
<scratch space>:21:1: note: expanded from here
NEON_DO4
^~~~~~~~
/mnt/devops/code/qemu/target-arm/neon_helper.c:93:5: note: expanded from macro 'NEON_DO4'
    NEON_FN(vdest.v1, vsrc1.v1, vsrc2.v1); \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/devops/code/qemu/target-arm/neon_helper.c:1054:23: note: expanded from macro 'NEON_FN'
            dest = (1 << (sizeof(src1) * 8 - 1)); \
                 ~  ~~^~~~~~~~~~~~~~~~~~~~~~~~~

Fix it by casting to appropriate type.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 target-arm/neon_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 1f1844f..ebdf7c9 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -1051,7 +1051,7 @@ uint64_t HELPER(neon_qrshl_u64)(CPUARMState *env, uint64_t val, uint64_t shiftop
     if (tmp >= (ssize_t)sizeof(src1) * 8) { \
         if (src1) { \
             SET_QC(); \
-            dest = (1 << (sizeof(src1) * 8 - 1)); \
+            dest = (typeof(dest))(1 << (sizeof(src1) * 8 - 1)); \
             if (src1 > 0) { \
                 dest--; \
             } \
-- 
2.9.2

  parent reply	other threads:[~2016-08-09 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 19:02 [Qemu-devel] [PATCH 1/5] atomic: strip "const" from variables declared with typeof Pranith Kumar
2016-08-09 19:02 ` [Qemu-devel] [PATCH 2/5] softfloat: Fix warn about implicit conversion from int to int8_t Pranith Kumar
2016-08-09 19:16   ` Aurelien Jarno
2016-08-09 21:12     ` Peter Maydell
2016-08-10 12:27       ` Aurelien Jarno
2016-08-10 10:32   ` Richard Henderson
2016-08-10 10:37     ` Peter Maydell
2016-08-10 12:12       ` Paolo Bonzini
2016-08-09 19:02 ` [Qemu-devel] [PATCH 3/5] Disable warn about left shifts of negative values Pranith Kumar
2016-08-09 19:02 ` [Qemu-devel] [PATCH 4/5] clang: Fix warning reg. expansion to 'defined' Pranith Kumar
2016-08-09 19:02 ` Pranith Kumar [this message]
2016-08-11 10:50   ` [Qemu-devel] [PATCH 5/5] target-arm: Fix warn about implicit conversion Peter Maydell
2016-08-12 12:20     ` Peter Maydell
2016-08-09 20:14 ` [Qemu-devel] [PATCH 1/5] atomic: strip "const" from variables declared with typeof Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160809190229.27871-5-bobby.prani@gmail.com \
    --to=bobby.prani@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).