$OpenBSD: patch-binutils_elfedit_c,v 1.1 2011/10/02 18:26:32 jasper Exp $

Fix -Wbounded warnings by using correct casts.

--- binutils/elfedit.c.orig	Fri Sep 30 16:29:00 2011
+++ binutils/elfedit.c	Fri Sep 30 16:33:14 2011
@@ -169,6 +169,10 @@ update_elf_header (const char *file_name, FILE *file)
 static int
 get_file_header (FILE * file)
 {
+  /* Temporary var to prevent the GCC -Wbounded checker from firing. */
+  void *tmp32 = &ehdr32.e_type[0];
+  void *tmp64 = &ehdr64.e_type[0];
+
   /* Read in the identity array.  */
   if (fread (elf_header.e_ident, EI_NIDENT, 1, file) != 1)
     return 0;
@@ -198,8 +202,7 @@ get_file_header (FILE * file)
       return 0;
 
     case ELFCLASS32:
-      if (fread (ehdr32.e_type, sizeof (ehdr32) - EI_NIDENT,
-		 1, file) != 1)
+      if (fread (tmp32, sizeof (ehdr32) - EI_NIDENT, 1, file) != 1)
 	return 0;
 
       elf_header.e_type      = BYTE_GET (ehdr32.e_type);
@@ -231,8 +234,7 @@ get_file_header (FILE * file)
 	  return 0;
 	}
 
-      if (fread (ehdr64.e_type, sizeof (ehdr64) - EI_NIDENT,
-		 1, file) != 1)
+      if (fread (tmp64, sizeof (ehdr64) - EI_NIDENT, 1, file) != 1)
 	return 0;
 
       elf_header.e_type      = BYTE_GET (ehdr64.e_type);
