All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error.
@ 2020-07-30  1:56 Kaige Li
  2020-07-30  1:56 ` [PATCH 2/2] target/arm: Fix " Kaige Li
  0 siblings, 1 reply; 7+ messages in thread
From: Kaige Li @ 2020-07-30  1:56 UTC (permalink / raw)
  To: David Hildenbrand, Michael S. Tsirkin, Peter Maydell
  Cc: Kaige Li, qemu-arm, qemu-devel

When I compile qemu with such as:

git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
make

There is error log:

/home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’:
/home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=]
         error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name,
         ^
cc1: all warnings being treated as errors
/home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed

So, change PRIx32 to PRIXPTR to fix this.

Signed-off-by: Kaige Li <likaige@loongson.cn>
---
 hw/virtio/virtio-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index c12e9f7..3dcaf9a 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name,
     }
 
     if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) {
-        error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name,
+        error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name,
                    VIRTIO_MEM_MIN_BLOCK_SIZE);
         return;
     } else if (!is_power_of_2(value)) {
-- 
2.1.0



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

* [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30  1:56 [PATCH 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error Kaige Li
@ 2020-07-30  1:56 ` Kaige Li
  2020-07-30  8:44   ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Kaige Li @ 2020-07-30  1:56 UTC (permalink / raw)
  To: David Hildenbrand, Michael S. Tsirkin, Peter Maydell
  Cc: Kaige Li, qemu-arm, qemu-devel

When I compile qemu with such as:

git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
make

There is error log:

/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
     ^
/home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
     AtomicThreeOpFn *fn;
                      ^
cc1: all warnings being treated as errors

So, add an initiallization value for fn to fix this.

Signed-off-by: Kaige Li <likaige@loongson.cn>
---
 target/arm/translate-a64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 8c07649..910a91f 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -3315,7 +3315,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
     bool r = extract32(insn, 22, 1);
     bool a = extract32(insn, 23, 1);
     TCGv_i64 tcg_rs, clean_addr;
-    AtomicThreeOpFn *fn;
+    AtomicThreeOpFn *fn = tcg_gen_atomic_fetch_add_i64;
 
     if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
         unallocated_encoding(s);
-- 
2.1.0



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

* Re: [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30  1:56 ` [PATCH 2/2] target/arm: Fix " Kaige Li
@ 2020-07-30  8:44   ` Peter Maydell
  2020-07-30 11:18     ` Kaige Li
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2020-07-30  8:44 UTC (permalink / raw)
  To: Kaige Li; +Cc: Michael S. Tsirkin, QEMU Developers, qemu-arm, David Hildenbrand

On Thu, 30 Jul 2020 at 02:56, Kaige Li <likaige@loongson.cn> wrote:
>
> When I compile qemu with such as:
>
> git clone https://git.qemu.org/git/qemu.git
> cd qemu
> git submodule init
> git submodule update --recursive
> ./configure
> make
>
> There is error log:
>
> /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
> /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>      fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
>      ^
> /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
>      AtomicThreeOpFn *fn;
>                       ^
> cc1: all warnings being treated as errors
>
> So, add an initiallization value for fn to fix this.
>
> Signed-off-by: Kaige Li <likaige@loongson.cn>

What compiler version is this ?

> ---
>  target/arm/translate-a64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index 8c07649..910a91f 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -3315,7 +3315,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
>      bool r = extract32(insn, 22, 1);
>      bool a = extract32(insn, 23, 1);
>      TCGv_i64 tcg_rs, clean_addr;
> -    AtomicThreeOpFn *fn;
> +    AtomicThreeOpFn *fn = tcg_gen_atomic_fetch_add_i64;

NULL would be a better choice for a "this is never actually used"
initialiser.

thanks
-- PMM


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

* Re: [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30  8:44   ` Peter Maydell
@ 2020-07-30 11:18     ` Kaige Li
  2020-07-30 11:21       ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Kaige Li @ 2020-07-30 11:18 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Michael S. Tsirkin, QEMU Developers, qemu-arm, David Hildenbrand

On 07/30/2020 04:44 PM, Peter Maydell wrote:

> On Thu, 30 Jul 2020 at 02:56, Kaige Li <likaige@loongson.cn> wrote:
>> When I compile qemu with such as:
>>
>> git clone https://git.qemu.org/git/qemu.git
>> cd qemu
>> git submodule init
>> git submodule update --recursive
>> ./configure
>> make
>>
>> There is error log:
>>
>> /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
>> /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>       fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
>>       ^
>> /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
>>       AtomicThreeOpFn *fn;
>>                        ^
>> cc1: all warnings being treated as errors
>>
>> So, add an initiallization value for fn to fix this.
>>
>> Signed-off-by: Kaige Li <likaige@loongson.cn>
> What compiler version is this ?
It's the latest version: v5.1.0-rc2, but VERSION shows that is 5.0.92.
Commit id is 5772f2b1fc5d00e7e04e01fa28e9081d6550440a
>
>> ---
>>   target/arm/translate-a64.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
>> index 8c07649..910a91f 100644
>> --- a/target/arm/translate-a64.c
>> +++ b/target/arm/translate-a64.c
>> @@ -3315,7 +3315,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
>>       bool r = extract32(insn, 22, 1);
>>       bool a = extract32(insn, 23, 1);
>>       TCGv_i64 tcg_rs, clean_addr;
>> -    AtomicThreeOpFn *fn;
>> +    AtomicThreeOpFn *fn = tcg_gen_atomic_fetch_add_i64;
> NULL would be a better choice for a "this is never actually used"
> initialiser.
Ok, I will have a try and submit it in v2.

Thank you.
Kaige.
>
> thanks
> -- PMM



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

* Re: [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30 11:18     ` Kaige Li
@ 2020-07-30 11:21       ` Peter Maydell
  2020-07-30 11:27         ` Kaige Li
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2020-07-30 11:21 UTC (permalink / raw)
  To: Kaige Li; +Cc: qemu-arm, David Hildenbrand, QEMU Developers, Michael S. Tsirkin

On Thu, 30 Jul 2020 at 12:19, Kaige Li <likaige@loongson.cn> wrote:
>
> On 07/30/2020 04:44 PM, Peter Maydell wrote:
>
> > On Thu, 30 Jul 2020 at 02:56, Kaige Li <likaige@loongson.cn> wrote:
> >> When I compile qemu with such as:
> >>
> >> git clone https://git.qemu.org/git/qemu.git
> >> cd qemu
> >> git submodule init
> >> git submodule update --recursive
> >> ./configure
> >> make
> >>
> >> There is error log:
> >>
> >> /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
> >> /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >>       fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
> >>       ^
> >> /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
> >>       AtomicThreeOpFn *fn;
> >>                        ^
> >> cc1: all warnings being treated as errors
> >>
> >> So, add an initiallization value for fn to fix this.
> >>
> >> Signed-off-by: Kaige Li <likaige@loongson.cn>
> > What compiler version is this ?
> It's the latest version: v5.1.0-rc2, but VERSION shows that is 5.0.92.
> Commit id is 5772f2b1fc5d00e7e04e01fa28e9081d6550440a

I asked for the compiler version, not the QEMU version :-)
Clang, gcc, OSX clang, something else, and which version number?

-- PMM


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

* Re: [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30 11:21       ` Peter Maydell
@ 2020-07-30 11:27         ` Kaige Li
  2020-07-30 11:33           ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Kaige Li @ 2020-07-30 11:27 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-arm, David Hildenbrand, QEMU Developers, Michael S. Tsirkin

On 07/30/2020 07:21 PM, Peter Maydell wrote:

> On Thu, 30 Jul 2020 at 12:19, Kaige Li <likaige@loongson.cn> wrote:
>> On 07/30/2020 04:44 PM, Peter Maydell wrote:
>>
>>> On Thu, 30 Jul 2020 at 02:56, Kaige Li <likaige@loongson.cn> wrote:
>>>> When I compile qemu with such as:
>>>>
>>>> git clone https://git.qemu.org/git/qemu.git
>>>> cd qemu
>>>> git submodule init
>>>> git submodule update --recursive
>>>> ./configure
>>>> make
>>>>
>>>> There is error log:
>>>>
>>>> /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
>>>> /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>>        fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
>>>>        ^
>>>> /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
>>>>        AtomicThreeOpFn *fn;
>>>>                         ^
>>>> cc1: all warnings being treated as errors
>>>>
>>>> So, add an initiallization value for fn to fix this.
>>>>
>>>> Signed-off-by: Kaige Li <likaige@loongson.cn>
>>> What compiler version is this ?
>> It's the latest version: v5.1.0-rc2, but VERSION shows that is 5.0.92.
>> Commit id is 5772f2b1fc5d00e7e04e01fa28e9081d6550440a
> I asked for the compiler version, not the QEMU version :-)
> Clang, gcc, OSX clang, something else, and which version number?
Sorry for that. Gcc version is 4.9.4.
> -- PMM



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

* Re: [PATCH 2/2] target/arm: Fix compile error.
  2020-07-30 11:27         ` Kaige Li
@ 2020-07-30 11:33           ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2020-07-30 11:33 UTC (permalink / raw)
  To: Kaige Li; +Cc: qemu-arm, David Hildenbrand, QEMU Developers, Michael S. Tsirkin

On Thu, 30 Jul 2020 at 12:28, Kaige Li <likaige@loongson.cn> wrote:
>
> On 07/30/2020 07:21 PM, Peter Maydell wrote:
> > Clang, gcc, OSX clang, something else, and which version number?
> Sorry for that. Gcc version is 4.9.4.

Ah, that makes sense. That's a pretty old version of gcc (it's
almost the oldest we still support), and it had more false-positives
for maybe-used-uninitialized warnings than more recent gcc versions.
Adding in the = NULL initializer should help it.

thanks
-- PMM


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

end of thread, other threads:[~2020-07-30 11:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  1:56 [PATCH 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error Kaige Li
2020-07-30  1:56 ` [PATCH 2/2] target/arm: Fix " Kaige Li
2020-07-30  8:44   ` Peter Maydell
2020-07-30 11:18     ` Kaige Li
2020-07-30 11:21       ` Peter Maydell
2020-07-30 11:27         ` Kaige Li
2020-07-30 11:33           ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.