http://sourceware.org/bugzilla/show_bug.cgi?id=14775
Bug #: 14775
Summary: [2.23] gas build failure for aarch64-linux: set but
not used variable in tc-aarch64.c:first_error_fmt
Product: binutils
Version: 2.23
Status: NEW
Severity: normal
Priority: P2
Component: gas
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
I've previously built cvs head snapshots for aarch64-linux. Attempting to do
so with the binutils-2.23 release fails as follows:
gcc -DHAVE_CONFIG_H -I. -I/tmp/binutils-2.23/gas -I. -I/tmp/binutils-2.23/gas
-I../bfd -I/tmp/binutils-2.23/gas/config -I/tmp/binutils-2.23/gas/../include
-I/tmp/binutils-2.23/gas/.. -I/tmp/binutils-2.23/gas/../bfd
-DLOCALEDIR="\"/tmp/install/share/locale\"" -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wshadow -Werror -g -O2 -MT tc-aarch64.o -MD -MP -MF
.deps/tc-aarch64.Tpo -c -o tc-aarch64.o `test -f 'config/tc-aarch64.c' || echo
'/tmp/binutils-2.23/gas/'`config/tc-aarch64.c
/tmp/binutils-2.23/gas/config/tc-aarch64.c: In function 'first_error_fmt':
/tmp/binutils-2.23/gas/config/tc-aarch64.c:646:11: error: variable 'ret' set
but not used [-Werror=unused-but-set-variable]
The code in question is:
{
int ret;
va_start (args, format);
ret = vsnprintf (buffer, size, format, args);
know (ret <= size - 1 && ret >= 0);
va_end (args);
set_syntax_error (buffer);
}
That is, the variable ret is only used in the assert-like know call. However,
know is a macro that expands to a dummy statement (do{}while(0)), so the actual
parameter expression disappears and ret is unused-but-set.
This doesn't happen when building from cvs head, presumably because know then
expands to gas_assert which does evaluate the expression.
I don't want to use --disable-werror by default. Is there a reason why know(p)
can't use the standard technique of expanding to (void)(p)? That change fixes
the problem for me.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils