https://sourceware.org/bugzilla/show_bug.cgi?id=19311
--- Comment #12 from Loria <Loria at phantasia dot org> --- Well the optimzer removed all my tries to tell the optimizer to not unrolling the loop the way it did. adding print("%d",i) will stop the loop unroller. (I tryed all sorts of things, also your sugestion using an inline function instead of the macro. The clang optimizer completly removed the inlinefunction to form the same as with the macro ...) I also crosschecked with 32bit which has the same issue. I was successful with the following, which actually pulls us around the bug, since we exit the funktion befor entering the loop. <- unsigned int encode_arm_immediate (unsigned int val) { unsigned int a, i; if(val <= 0xFF) return val; 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; } <- this would now work as we need it. It wont stop the clang bug to hit somewhere else. I also was successful in compiling the original function with: gcc -O2 -fno-unroll-loops -fbracket-depth=1024 test.c if ppl want to be on the safe side, they should add -fno-unroll-loops all others could use the "risky" version and only use the workaround .. I could produce a patch to binutils 2.25.1 or head of git ... if you would like to have the workaround within binutils .. it seems to have been done with encode_thumb32_immediate (unsigned int val) already. The main loop is similar. I filed a bugreport at the LLVM.Org .. -- 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