Date: Sat, 22 Nov 2014 16:30:31 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274856 - head/contrib/binutils/gas/config Message-ID: <201411221630.sAMGUV83056587@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Nov 22 16:30:31 2014 New Revision: 274856 URL: https://svnweb.freebsd.org/changeset/base/274856 Log: Avoid undefined behaviour in gas's rotate_left() macro for n == 0. Otherwise, clang can effectively remove the first iteration of the for loops where this macro is invoked, and as a result, "cmp r0, #99" fails to assemble. Obtained from: joerg at netbsd MFC after: 3 days Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Sat Nov 22 16:27:51 2014 (r274855) +++ head/contrib/binutils/gas/config/tc-arm.c Sat Nov 22 16:30:31 2014 (r274856) @@ -6079,7 +6079,7 @@ parse_operands (char *str, const unsigne /* Functions for operand encoding. ARM, then Thumb. */ -#define rotate_left(v, n) (v << n | v >> (32 - n)) +#define rotate_left(v, n) (v << (n % 32) | v >> ((32 - n) % 32)) /* If VAL can be encoded in the immediate field of an ARM instruction, return the encoded form. Otherwise, return FAIL. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411221630.sAMGUV83056587>