This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
bswap_32() macro with postincrement
- From: Kurt Roeckx <kurt at roeckx dot be>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 09 Mar 2011 22:34:48 +0100
- Subject: bswap_32() macro with postincrement
Hi,
It seems that the bswap_32() is causing this error on m68k:
gnuhash_xlate.h: In function `elf_cvt_gnuhash':
gnuhash_xlate.h:92: error: operation on `src32' may be undefined
The problem is that bswap_32() is a macro, and so the
postincrement could be executed multiple time. But
I assume that a macro like that is supposed to protect
the caller from causing that problem, but I'm not really
sure.
Anyway, this patch will fix the issue on m68k:
diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h
index d79764d..4783d6b 100644
--- a/libelf/gnuhash_xlate.h
+++ b/libelf/gnuhash_xlate.h
@@ -89,7 +89,8 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
dest32 = (Elf32_Word *) &dest64[bitmask_words];
while (len >= 4)
{
- *dest32++ = bswap_32 (*src32++);
+ *dest32++ = bswap_32 (*src32);
+ ++src32;
len -= 4;
}
}
Bug report and patch provided by Thorsten Glaser <tg@mirbsd.de>,
more information is at http://bugs.debian.org/595496
Kurt