* [PATCH v2 2/2] target/arm: Fix compile error.
2020-07-30 11:57 [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error Kaige Li
@ 2020-07-30 11:57 ` Kaige Li
2020-07-30 13:17 ` Philippe Mathieu-Daudé
2020-07-30 20:45 ` Peter Maydell
2020-07-30 12:03 ` [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix " David Hildenbrand
2020-07-30 13:15 ` Philippe Mathieu-Daudé
2 siblings, 2 replies; 10+ messages in thread
From: Kaige Li @ 2020-07-30 11:57 UTC (permalink / raw)
To: Michael S. Tsirkin, David Hildenbrand, 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 NULL 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..c98dfb1 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 = NULL;
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
unallocated_encoding(s);
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] target/arm: Fix compile error.
2020-07-30 11:57 ` [PATCH v2 2/2] target/arm: Fix " Kaige Li
@ 2020-07-30 13:17 ` Philippe Mathieu-Daudé
2020-07-30 20:47 ` Peter Maydell
2020-07-30 20:45 ` Peter Maydell
1 sibling, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-30 13:17 UTC (permalink / raw)
To: Kaige Li, Michael S. Tsirkin, David Hildenbrand, Peter Maydell
Cc: qemu-arm, qemu-devel
On 7/30/20 1:57 PM, Kaige Li 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
Again, timeless information is not useful.
>
> 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
Again, what compiler / version are you using? My guess is you are
using an old GCC, and I wonder if it is still supported.
>
> So, add an initiallization value NULL 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..c98dfb1 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 = NULL;
>
> if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
> unallocated_encoding(s);
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] target/arm: Fix compile error.
2020-07-30 13:17 ` Philippe Mathieu-Daudé
@ 2020-07-30 20:47 ` Peter Maydell
0 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2020-07-30 20:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Kaige Li, David Hildenbrand, QEMU Developers, qemu-arm,
Michael S. Tsirkin
On Thu, 30 Jul 2020 at 14:17, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Again, what compiler / version are you using? My guess is you are
> using an old GCC, and I wonder if it is still supported.
configure complains if you use a gcc so old we don't support
it (our current minimum is GCC 4.8; Kaige is using GCC 4.9.4.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] target/arm: Fix compile error.
2020-07-30 11:57 ` [PATCH v2 2/2] target/arm: Fix " Kaige Li
2020-07-30 13:17 ` Philippe Mathieu-Daudé
@ 2020-07-30 20:45 ` Peter Maydell
2020-07-31 1:26 ` Kaige Li
1 sibling, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2020-07-30 20:45 UTC (permalink / raw)
To: Kaige Li; +Cc: David Hildenbrand, QEMU Developers, qemu-arm, Michael S. Tsirkin
On Thu, 30 Jul 2020 at 12:58, 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 NULL for fn to fix this.
>
> Signed-off-by: Kaige Li <likaige@loongson.cn>
Hi; I've taken this patch (but not patch 1 in the series)
into target-arm.next, with the commit message cleaned up
to quote the compiler version.
thanks
-- PMM
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] target/arm: Fix compile error.
2020-07-30 20:45 ` Peter Maydell
@ 2020-07-31 1:26 ` Kaige Li
0 siblings, 0 replies; 10+ messages in thread
From: Kaige Li @ 2020-07-31 1:26 UTC (permalink / raw)
To: Peter Maydell
Cc: David Hildenbrand, QEMU Developers, qemu-arm, Michael S. Tsirkin
On 07/31/2020 04:45 AM, Peter Maydell wrote:
> On Thu, 30 Jul 2020 at 12:58, 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 NULL for fn to fix this.
>>
>> Signed-off-by: Kaige Li <likaige@loongson.cn>
> Hi; I've taken this patch (but not patch 1 in the series)
> into target-arm.next, with the commit message cleaned up
> to quote the compiler version.
Hi, did you mean I should commit this patch separately, not in a series
of patches?
and the submission information should be added to the gcc version and
cpu architecture?
Thanks for your patience and suggestion .
Kaige.
> thanks
> -- PMM
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error.
2020-07-30 11:57 [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error Kaige Li
2020-07-30 11:57 ` [PATCH v2 2/2] target/arm: Fix " Kaige Li
@ 2020-07-30 12:03 ` David Hildenbrand
2020-07-30 12:57 ` David Hildenbrand
2020-07-30 13:15 ` Philippe Mathieu-Daudé
2 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand @ 2020-07-30 12:03 UTC (permalink / raw)
To: Kaige Li, Michael S. Tsirkin, Peter Maydell; +Cc: qemu-arm, qemu-devel
On 30.07.20 13:57, Kaige Li 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/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)) {
>
That's not what I suggested ... and you should mention the compiler/host
architecture used.
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error.
2020-07-30 12:03 ` [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix " David Hildenbrand
@ 2020-07-30 12:57 ` David Hildenbrand
0 siblings, 0 replies; 10+ messages in thread
From: David Hildenbrand @ 2020-07-30 12:57 UTC (permalink / raw)
To: Kaige Li, Michael S. Tsirkin, Peter Maydell
Cc: Stefano Garzarella, qemu-arm, qemu-devel, Bruce Rogers
On 30.07.20 14:03, David Hildenbrand wrote:
> On 30.07.20 13:57, Kaige Li 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/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)) {
>>
>
> That's not what I suggested ... and you should mention the compiler/host
> architecture used.
>
Sorry, I thought this was a resend from Bruce:
https://lkml.kernel.org/r/1b00c0e25ec65e113d4c7fa98b1466689f05a986.camel@suse.com
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error.
2020-07-30 11:57 [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error Kaige Li
2020-07-30 11:57 ` [PATCH v2 2/2] target/arm: Fix " Kaige Li
2020-07-30 12:03 ` [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix " David Hildenbrand
@ 2020-07-30 13:15 ` Philippe Mathieu-Daudé
2020-07-31 3:52 ` Kaige Li
2 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-30 13:15 UTC (permalink / raw)
To: Kaige Li, Michael S. Tsirkin, David Hildenbrand, Peter Maydell
Cc: qemu-arm, qemu-devel
On 7/30/20 1:57 PM, Kaige Li 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
^ this timeless description is pointless (think at a developer
who read this in 2 weeks, 3 months, 1 year).
>
> 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=]
What compiler are you using? That is the relevant information to
include.
> 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)) {
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error.
2020-07-30 13:15 ` Philippe Mathieu-Daudé
@ 2020-07-31 3:52 ` Kaige Li
0 siblings, 0 replies; 10+ messages in thread
From: Kaige Li @ 2020-07-31 3:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé,
Michael S. Tsirkin, David Hildenbrand, Peter Maydell
Cc: qemu-arm, qemu-devel
On 07/30/2020 09:15 PM, Philippe Mathieu-Daudé wrote:
> On 7/30/20 1:57 PM, Kaige Li 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
> ^ this timeless description is pointless (think at a developer
> who read this in 2 weeks, 3 months, 1 year).
Thanks for your suggestions, I will delete it.
>
>> 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=]
> What compiler are you using? That is the relevant information to
> include.
Gcc version is 4.9.4.
>
>> 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)) {
>>
^ permalink raw reply [flat|nested] 10+ messages in thread