From patchwork Fri Nov 15 17:38:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35944 Received: (qmail 119542 invoked by alias); 15 Nov 2019 17:38:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 119529 invoked by uid 89); 15 Nov 2019 17:38:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1827 X-HELO: mx1.osci.io X-Gerrit-PatchSet: 1 Date: Fri, 15 Nov 2019 12:38:13 -0500 From: "Florian Weimer (Code Review)" To: libc-alpha@sourceware.org Cc: Florian Weimer Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] hurd: Fix GCC 10 -Warray-bounds warning in init-first.c X-Gerrit-Change-Id: Ided58244ca0ee48892519faac5ac222a4e02dec4 X-Gerrit-Change-Number: 657 X-Gerrit-ChangeURL: X-Gerrit-Commit: 2f812a2e5ba91647b1271b5637159f74de520781 References: Reply-To: fweimer@redhat.com, fweimer@redhat.com, libc-alpha@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-76-gf8b6da0ab5 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/657 ...................................................................... hurd: Fix GCC 10 -Warray-bounds warning in init-first.c The trampoline code should really be rewritten in assembler because this is all very undefined at the C level. Change-Id: Ided58244ca0ee48892519faac5ac222a4e02dec4 --- M sysdeps/mach/hurd/i386/init-first.c 1 file changed, 10 insertions(+), 0 deletions(-) diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index f1f1c40..286d2a0 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -30,6 +30,7 @@ #include #include +#include extern void __mach_init (void); extern void __init_misc (int, char **, char **); @@ -144,9 +145,16 @@ static inline void init (int *data) { + /* data is the address of the argc parameter to _dl_init_first or + doinit1 in _hurd_stack_setup, so the array subscripts are + undefined. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (10, "-Warray-bounds"); + int argc = *data; char **argv = (void *) (data + 1); char **envp = &argv[argc + 1]; + struct hurd_startup_data *d; /* Since the cthreads initialization code uses malloc, and the @@ -265,6 +273,8 @@ restored by function return. */ asm volatile ("# a %0 c %1" : : "a" (usercode), "c" (&init1)); } + + DIAG_POP_NEEDS_COMMENT; /* -Warray-bounds. */ } /* These bits of inline assembler used to be located inside `init'.