Hello!
Attached patch fixes PR 68323, where code tries to access what
compiler think is out of bounds element.
2014-12-15 Uros Bizjak <[email protected]>
PR libgcc/63832
* crtstuff.c (__do_global_dtors_aux) [HIDDEN_DTOR_LIST_END]: Use
func_ptr *dtor_list temporary variable to avoid "array subscript
is above array bounds" warnings.
Bootstrapped and regression tested on x86_64-linux-gnu {,m32} CentOS 5.11.
OK for mainline?
Uros.
Index: crtstuff.c
===================================================================
--- crtstuff.c (revision 218733)
+++ crtstuff.c (working copy)
@@ -393,13 +393,11 @@ __do_global_dtors_aux (void)
extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
static size_t dtor_idx;
const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
- func_ptr f;
+ func_ptr *dtor_list;
+ __asm ("" : "=g" (dtor_list) : "0" (__DTOR_LIST__));
while (dtor_idx < max_idx)
- {
- f = __DTOR_LIST__[++dtor_idx];
- f ();
- }
+ dtor_list[++dtor_idx] ();
}
#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
{