https://sourceware.org/bugzilla/show_bug.cgi?id=19311

--- Comment #6 from Loria <Loria at phantasia dot org> ---
The Toolchain used to build the binutils...
<gcc --version>
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
</gcc --version>
This seems to be an 4.2.1 ...

Investigation so far shows evidence of some problem with loop optimization of
the construct used in "encode_arm_immediate"
doing output of newimm & value after 
          newimm = encode_arm_immediate (value);
leaves some interesting values if the loop in "encode_arm_immediate" should
exit with i=0 .. but it seems to exit and checks with i=2 ...
<some samples>
0xE13 = encode_arm_immediate (0x130)
0x100 = encode_arm_immediate (0x0)
0x180 = encode_arm_immediate (0x20)
0xFFFFFFFF = encode_arm_immediate (0xAF)
<some samples>
<loop>
#define rotate_left(v, n) (v << n | v >> (32 - n))
  for (i = 0; i < 32; i += 2)
    if ((a = rotate_left (val, i)) <= 0xff)
      return a | (i << 7); /* 12-bit pack: [shift-cnt,const].  */
  return FAIL;
</loop>
If I add an output of "i" before the check is done everything seems ok ..
<loop>
  for (i = 0; i < 32; i += 2){
printf("%u\n",i);
    if ((a = rotate_left (val, i)) <= 0xff)
      return a | (i << 7); /* 12-bit pack: [shift-cnt,const].  */
  }
  return FAIL;
</loop>
I am looking for a way to either add a workaround or set some optimzerflag to
stop the broken code from beeing submitted.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to