From: Fangrui Song Date: Fri, 3 May 2019 00:11:53 +0000 (+0000) Subject: [crtbegin] Fix an off-by-1 bug in __do_fini X-Git-Tag: llvmorg-10-init~6386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3947968e7fa35b004b71812a7b4a3fed7de8b781;p=platform%2Fupstream%2Fllvm.git [crtbegin] Fix an off-by-1 bug in __do_fini Differential Revision: https://reviews.llvm.org/D61367 llvm-svn: 359850 --- diff --git a/compiler-rt/lib/crt/crtbegin.c b/compiler-rt/lib/crt/crtbegin.c index 523ff6f..cfbe5e5 100644 --- a/compiler-rt/lib/crt/crtbegin.c +++ b/compiler-rt/lib/crt/crtbegin.c @@ -77,7 +77,7 @@ static void __attribute__((used)) __do_fini() { __deregister_frame_info(__EH_FRAME_LIST__); const size_t n = __DTOR_LIST_END__ - __DTOR_LIST__ - 1; - for (size_t i = 1; i < n; i++) __DTOR_LIST__[i](); + for (size_t i = 1; i <= n; i++) __DTOR_LIST__[i](); #endif }