On 12.01.22 08:40, Bezdeka, Florian (T CED SES-DE) wrote:
On Wed, 2022-01-12 at 06:44 +0000, Peng Fan wrote:
Subject: Re: [PATCH] hypervisor: arm/arm64: fix build error

On 12.01.22 07:56, Peng Fan (OSS) wrote:
From: Peng Fan <[email protected]>

With gcc 5.15, met the following error

Which gcc version (surely not "5.15") from which distro? I've tried
with
manually adding -Werror=array-bounds to the build and using gcc-
10.3.1, but
this message didn't trigger.

I use NXP linux 5.15-honister, gcc version 11.2.0.



hypervisor/arch/arm64/control.c:33:9:
error: ‘memset’ offset [0, 255] is out of the bounds [0, 0]
[-Werror=array-bounds]
     33 |         memset(&this_cpu_data()->guest_regs, 0,
sizeof(union
registers));
        |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
cc1: all warnings being treated as errors

Fix this by use a volatile pointer to keep GCC from determining
its
value


Do we something wrong here, or did the kernel, e.g., had to work
around such
issues as well? The workaround looks a bit odd.

It is gcc try to determining the array value, but I am not sure why
it not.
This patch is to let gcc not determine the array value to avoid
build break.

This sounds like [1], another gcc 11.x issue with kernel / Jailhouse
sources. I had the same problem for x86 some time ago. Not sure if
there are kernel workarounds for that.

The bug was marked as duplicate of [2], which is the kernel issue.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100834
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578


Interesting. Just scanned for recent kernel commits containing "volatile" and referencing "gcc" in their log message, but I'm not yet finding anything related. Maybe too early to run after this gcc stuff? Or disable this check? But the latter may overshoot if that check was just expanded, not newly introduced.

Jan

--
Siemens AG, Technology
Competence Center Embedded Linux

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/b1fd0279-e42b-6041-fbaf-3e48ac3b9ebe%40siemens.com.

Reply via email to