From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Clément Chigot" <chigot@adacore.com>
Cc: Thomas Huth <thuth@redhat.com>,
Frederic Konrad <konrad.frederic@yahoo.fr>,
qemu-devel@nongnu.org,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Artyom Tarasenko <atar4qemu@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH] hw/sparc/leon3: Fix wrong usage of DO_UPCAST macro
Date: Thu, 22 Feb 2024 12:27:09 +0100 [thread overview]
Message-ID: <6e6ab585-5479-45c5-9042-b958e0dbdfeb@linaro.org> (raw)
In-Reply-To: <CAJ307Ei8-VE1Jsy_uZzLa_2=t76qB_eykZx-=0hNoaogGsUQaA@mail.gmail.com>
On 22/2/24 09:26, Clément Chigot wrote:
> Hi Philippe, Thomas
>
> Thanks for handling that !
> And I do confirm that it does not trigger any obvious regression on our side.
Since I screwed my hw-misc pull request, I'll add your Tested-by to the
commit before respin.
>
> Thanks,
> Clément
>
> On Thu, Feb 22, 2024 at 8:46 AM Philippe Mathieu-Daudé
> <philmd@linaro.org> wrote:
>>
>> On 21/2/24 19:49, Philippe Mathieu-Daudé wrote:
>>> On 21/2/24 19:47, Philippe Mathieu-Daudé wrote:
>>>> On 21/2/24 19:07, Thomas Huth wrote:
>>>>> leon3.c currently fails to compile with some compilers when the -Wvla
>>>>> option has been enabled:
>>>>>
>>>>> ../hw/sparc/leon3.c: In function ‘leon3_cpu_reset’:
>>>>> ../hw/sparc/leon3.c:153:5: error: ISO C90 forbids variable length
>>>>> array
>>>>> ‘offset_must_be_zero’ [-Werror=vla]
>>>>> 153 | ResetData *s = (ResetData *)DO_UPCAST(ResetData,
>>>>> info[id], info);
>>>>> | ^~~~~~~~~
>>>>> cc1: all warnings being treated as errors
>>>>>
>>>>> Looking at this code, the DO_UPCAST macro is indeed used in a wrong way
>>>>> here: DO_UPCAST is supposed to check that the second parameter is the
>>>>> first entry of the struct that the first parameter indicates, but since
>>>>> we use and index into the info[] array, this of course cannot work.
>>>>>
>>>>> The intention here was likely rather to use the container_of() macro
>>>>> instead, so switch the code accordingly.
>>>
>>> Fixes: d65aba8286 ("hw/sparc/leon3: implement multiprocessor")
>>>
>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>> ---
>>>>> hw/sparc/leon3.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>
>>
>> Patch queued!
>>
prev parent reply other threads:[~2024-02-22 11:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 18:07 [PATCH] hw/sparc/leon3: Fix wrong usage of DO_UPCAST macro Thomas Huth
2024-02-21 18:47 ` Philippe Mathieu-Daudé
2024-02-21 18:49 ` Philippe Mathieu-Daudé
2024-02-22 7:46 ` Philippe Mathieu-Daudé
2024-02-22 8:26 ` Clément Chigot
2024-02-22 11:27 ` Philippe Mathieu-Daudé [this message]
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=6e6ab585-5479-45c5-9042-b958e0dbdfeb@linaro.org \
--to=philmd@linaro.org \
--cc=atar4qemu@gmail.com \
--cc=chigot@adacore.com \
--cc=konrad.frederic@yahoo.fr \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).