This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] NDS32/BFD: Correct an aliasing error in `nds32_elf_check_relocs'

Fix an aliasing build error:

cc1: warnings being treated as errors
.../bfd/elf32-nds32.c: In function 'nds32_elf_check_relocs':
.../bfd/elf32-nds32.c:6644: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[3]: *** [elf32-nds32.lo] Error 1

in a way following commit 6edfbbad0864 ("Fix up gcc4.1 aliasing 
warnings"), <>.

	* elf32-nds32.c (nds32_elf_check_relocs): Avoid aliasing warning
	from GCC.
 Discovered in an `--enable-targets=all' build and committed as obvious.


Index: binutils/bfd/elf32-nds32.c
--- binutils.orig/bfd/elf32-nds32.c	2016-10-07 03:26:23.000000000 +0100
+++ binutils/bfd/elf32-nds32.c	2016-10-14 18:49:34.213789161 +0100
@@ -6629,6 +6629,7 @@ nds32_elf_check_relocs (bfd *abfd, struc
 		  asection *s;
+		  void *vpp;
 		  Elf_Internal_Sym *isym;
 		  isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx);
@@ -6640,8 +6641,8 @@ nds32_elf_check_relocs (bfd *abfd, struc
 		  if (s == NULL)
 		    return FALSE;
-		  head = ((struct elf_nds32_dyn_relocs **)
-			&elf_section_data (s)->local_dynrel);
+		  vpp = &elf_section_data (s)->local_dynrel;
+		  head = (struct elf_nds32_dyn_relocs **) vpp;
 	      p = *head;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]