This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] elf32-xtensa.c build error with FSF GCC HEAD
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: binutils at sourceware dot org
- Date: Fri, 5 Oct 2012 10:31:59 +0200
- Subject: [patch] elf32-xtensa.c build error with FSF GCC HEAD
Hi,
FAIL: gcc (GCC) 4.8.0 20121001 (experimental)
CC=.../gcchead-root/bin/gcc CFLAGS="" ./configure --enable-targets=all;make
/bin/sh ./libtool --tag=CC --mode=compile /home/jkratoch/redhat/gcchead-root/bin/gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_all_vecs -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -MT elf32-xtensa.lo -MD -MP -MF .deps/elf32-xtensa.Tpo -c -o elf32-xtensa.lo elf32-xtensa.c
libtool: compile: /home/jkratoch/redhat/gcchead-root/bin/gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_all_vecs -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -MT elf32-xtensa.lo -MD -MP -MF .deps/elf32-xtensa.Tpo -c elf32-xtensa.c -o elf32-xtensa.o
elf32-xtensa.c: In function ‘clear_section_cache’:
elf32-xtensa.c:6078:36: error: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
memset (sec_cache, 0, sizeof (sec_cache));
^
elf32-xtensa.c: In function ‘section_cache_section’:
elf32-xtensa.c:6120:32: error: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
memset (sec_cache, 0, sizeof (sec_cache));
^
cc1: all warnings being treated as errors
I believe the second memset is redundant. Not regression tested. I will
check it in in this form without comments.
Thanks,
Jan
bfd/
2012-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* elf32-xtensa.c (clear_section_cache, section_cache_section): Fix
size of SEC_CACHE memset.
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 797979f..231bb7c 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -6075,7 +6075,7 @@ clear_section_cache (section_cache_t *sec_cache)
release_internal_relocs (sec_cache->sec, sec_cache->relocs);
if (sec_cache->ptbl)
free (sec_cache->ptbl);
- memset (sec_cache, 0, sizeof (sec_cache));
+ memset (sec_cache, 0, sizeof (*sec_cache));
}
}
@@ -6117,7 +6117,7 @@ section_cache_section (section_cache_t *sec_cache,
/* Fill in the new section cache. */
clear_section_cache (sec_cache);
- memset (sec_cache, 0, sizeof (sec_cache));
+ memset (sec_cache, 0, sizeof (*sec_cache));
sec_cache->sec = sec;
sec_cache->contents = contents;