diff mbox series

[review,v5] hurd: Suppress GCC 10 -Warray-bounds warning in init-first.c [BZ #25097]

Message ID 20191115175046.A3A2E20AF6@gnutoolchain-gerrit.osci.io
State New
Headers show
Series [review,v5] hurd: Suppress GCC 10 -Warray-bounds warning in init-first.c [BZ #25097] | expand

Commit Message

Adhemerval Zanella (Code Review) Nov. 15, 2019, 5:50 p.m. UTC
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/657
......................................................................

hurd: Suppress GCC 10 -Warray-bounds warning in init-first.c [BZ #25097]

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, 9 insertions(+), 0 deletions(-)

Comments

Samuel Thibault Nov. 16, 2019, 11:55 a.m. UTC | #1
Florian Weimer (Code Review), le ven. 15 nov. 2019 12:50:46 -0500, a ecrit:
> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/657
> ......................................................................
> 
> hurd: Suppress GCC 10 -Warray-bounds warning in init-first.c [BZ #25097]
> 
> The trampoline code should really be rewritten in assembler because
> this is all very undefined at the C level.
> 
> Change-Id: Ided58244ca0ee48892519faac5ac222a4e02dec4

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
> M sysdeps/mach/hurd/i386/init-first.c
> 1 file changed, 9 insertions(+), 0 deletions(-)
> 
> 
> 
> diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
> index f1f1c40..5c21ebb 100644
> --- a/sysdeps/mach/hurd/i386/init-first.c
> +++ b/sysdeps/mach/hurd/i386/init-first.c
> @@ -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 @@
>  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 @@
>  	 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'.
> 
> -- 
> Gerrit-Project: glibc
> Gerrit-Branch: master
> Gerrit-Change-Id: Ided58244ca0ee48892519faac5ac222a4e02dec4
> Gerrit-Change-Number: 657
> Gerrit-PatchSet: 5
> Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
> Gerrit-MessageType: newpatchset
>
diff mbox series

Patch

diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index f1f1c40..5c21ebb 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -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 @@ 
 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 @@ 
 	 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'.