* [PATCH, libgcc]: Fix PR 63832, crtstuff.c:400:19: warning: array subscript is above array bounds
@ 2014-12-15 17:33 Uros Bizjak
2014-12-15 18:30 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2014-12-15 17:33 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
Hello!
Attached patch fixes PR 68323, where code tries to access what
compiler think is out of bounds element.
2014-12-15 Uros Bizjak <ubizjak@gmail.com>
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.
[-- Attachment #2: l.diff.txt --]
[-- Type: text/plain, Size: 654 bytes --]
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) */
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH, libgcc]: Fix PR 63832, crtstuff.c:400:19: warning: array subscript is above array bounds
2014-12-15 17:33 [PATCH, libgcc]: Fix PR 63832, crtstuff.c:400:19: warning: array subscript is above array bounds Uros Bizjak
@ 2014-12-15 18:30 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2014-12-15 18:30 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches
On Mon, Dec 15, 2014 at 06:25:04PM +0100, Uros Bizjak wrote:
> Hello!
>
> Attached patch fixes PR 68323, where code tries to access what
> compiler think is out of bounds element.
>
> 2014-12-15 Uros Bizjak <ubizjak@gmail.com>
>
> 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?
Ok, thanks.
> 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) */
> {
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-15 17:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 17:33 [PATCH, libgcc]: Fix PR 63832, crtstuff.c:400:19: warning: array subscript is above array bounds Uros Bizjak
2014-12-15 18:30 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).