This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, libgcc]: Avoid warning: array subscript is above array bounds when compiling crtstuff.c
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 7 Mar 2014 18:36:20 +0100
- Subject: [PATCH, libgcc]: Avoid warning: array subscript is above array bounds when compiling crtstuff.c
- Authentication-results: sourceware.org; auth=none
Hello!
Attached patch avoids a bunch of:
../../../gcc-svn/trunk/libgcc/crtstuff.c: In function 'frame_dummy':
../../../gcc-svn/trunk/libgcc/crtstuff.c:463:19: warning: array
subscript is above array bounds [-Warray-bounds]
if (__JCR_LIST__[0])
^
when compiling libgcc.
2014-03-08 Uros Bizjak <ubizjak@gmail.com>
* crtstuff.c (__JCR_LIST__): Declare as zero-length array.
Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
OK for mainline?
Uros.
Index: crtstuff.c
===================================================================
--- crtstuff.c (revision 208403)
+++ crtstuff.c (working copy)
@@ -257,7 +257,7 @@ STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGI
#ifdef JCR_SECTION_NAME
/* Stick a label at the beginning of the java class registration info
so we can register them properly. */
-STATIC void *__JCR_LIST__[]
+STATIC void *__JCR_LIST__[0]
__attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
= { };
#endif /* JCR_SECTION_NAME */