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

Re: [Xen-devel] xen/x86: unable to build with gcc5



On Fri, 2015-03-13 at 12:10 +0000, Jan Beulich wrote:
[...]
> For all of the above, at a first glance I'd say compiler bug. But to
> be sure, could you send the three .o-s?

Attached.

> > symbols.c: In function 'symbols_lookup':
> > symbols.c:128:359: error: array subscript is above array bounds 
> > [-Werror=array-bounds]
> > symbols.c:136:176: error: array subscript is above array bounds 
> > [-Werror=array-bounds]
> > 
> > from common/symbols.c. I suppose because of
> >         extern const unsigned int symbols_offsets[1]
> >         #define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
> > 
> > I'm not sure why that needs to be a singleton array instead of []?
> 
> I don't see a reason other than someone having wanted to be
> standard C compliant (which we don't need to be here).

I've switched to Keir's current address in case he has a comment, but
the following fixes it for me:

8<-------------

From fbe732e5be6352afe2d9302f5d56439b9b9b6dee Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 13 Mar 2015 12:22:25 +0000
Subject: [PATCH] xen: common: Use unbounded array for symbols_offset.

Using a singleton array causes gcc5 to report:
symbols.c: In function 'symbols_lookup':
symbols.c:128:359: error: array subscript is above array bounds 
[-Werror=array-bounds]
symbols.c:136:176: error: array subscript is above array bounds 
[-Werror=array-bounds]

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/common/symbols.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index bc2fde6..fc7c9e7 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -19,7 +19,7 @@
 #include <xen/spinlock.h>
 
 #ifdef SYMBOLS_ORIGIN
-extern const unsigned int symbols_offsets[1];
+extern const unsigned int symbols_offsets[];
 #define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
 #else
 extern const unsigned long symbols_addresses[];
-- 
2.1.4



Attachment: boot.o
Description: application/object

Attachment: dmi_scan.o
Description: application/object

Attachment: unxz.o
Description: application/object

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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