[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] rombios: Work around GCC issue 99578



commit e35138a2ffbe1fe71edaaaaae71063dc545a8416
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Aug 17 21:32:53 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Aug 18 14:25:55 2023 +0100

    rombios: Work around GCC issue 99578
    
    GCC 12 objects to pointers derived from a constant:
    
      util.c: In function 'find_rsdp':
      util.c:429:16: error: array subscript 0 is outside array bounds of 
'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
        429 |     ebda_seg = *(uint16_t *)ADDR_FROM_SEG_OFF(0x40, 0xe);
      cc1: all warnings being treated as errors
    
    This is a GCC bug, but work around it rather than turning array-bounds
    checking off generally.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 tools/firmware/rombios/32bit/util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/firmware/rombios/32bit/util.c 
b/tools/firmware/rombios/32bit/util.c
index 6c1c480514..a47e000a26 100644
--- a/tools/firmware/rombios/32bit/util.c
+++ b/tools/firmware/rombios/32bit/util.c
@@ -424,10 +424,10 @@ static struct acpi_20_rsdp *__find_rsdp(const void 
*start, unsigned int len)
 struct acpi_20_rsdp *find_rsdp(void)
 {
     struct acpi_20_rsdp *rsdp;
-    uint16_t ebda_seg;
+    uint16_t *volatile /* GCC issue 99578 */ ebda_seg =
+        ADDR_FROM_SEG_OFF(0x40, 0xe);
 
-    ebda_seg = *(uint16_t *)ADDR_FROM_SEG_OFF(0x40, 0xe);
-    rsdp = __find_rsdp((void *)(ebda_seg << 16), 1024);
+    rsdp = __find_rsdp((void *)(*ebda_seg << 16), 1024);
     if (!rsdp)
         rsdp = __find_rsdp((void *)0xE0000, 0x20000);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.