This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, libgcc]: Avoid warning: array subscript is above array bounds when compiling crtstuff.c


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 */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]