]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Suppress GCC 10 -Warray-bounds warning in init-first.c [BZ #25097]
authorFlorian Weimer <fweimer@redhat.com>
Fri, 15 Nov 2019 17:36:58 +0000 (18:36 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Sat, 16 Nov 2019 14:40:59 +0000 (15:40 +0100)
The trampoline code should really be rewritten in assembler because
this is all very undefined at the C level.

Change-Id: Ided58244ca0ee48892519faac5ac222a4e02dec4

sysdeps/mach/hurd/i386/init-first.c

index f1f1c4038967e9539b47ce9803c041e00612627d..5c21ebb95897e60e88cad22893189624348ca922 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <ldsodefs.h>
 #include <fpu_control.h>
+#include <libc-diag.h>
 
 extern void __mach_init (void);
 extern void __init_misc (int, char **, char **);
@@ -144,6 +145,12 @@ init1 (int argc, char *arg0, ...)
 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];
@@ -265,6 +272,8 @@ init (int *data)
         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'.