bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/19311] arm-linux-as build on Mac OS X with Xcode7 fails to


From: Loria at phantasia dot org
Subject: [Bug binutils/19311] arm-linux-as build on Mac OS X with Xcode7 fails to assemble code from FreePascal cross-compiler
Date: Thu, 28 Jan 2016 08:35:56 +0000

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

--- Comment #15 from Loria <Loria at phantasia dot org> ---
I did some further investigateion about the issue of the shiftoperator. It is
no violation on the syntaxlevel of C & C++ for (uint32 VAL; uint32 X = VAL >>
32;), the behaviour of the shiftoperation  >= bitsize of the value  is
undefinied.
At least Microsoft does state it in their documentation
https://msdn.microsoft.com/en-us/library/336xbhcz.aspx#Anchor_5
There are more places, which state the same.
So it seems the use of ">>32" confuses clangs optimizer.

But I now think the behaviour of the current version of 
encode_arm_immediate to be undefined and should be fixed. 

I sugest the code to be changed to:
<--
unsigned int
encode_arm_immediate (unsigned int val)
{
  unsigned int a, i;

  if(val <= 0xFF)
    return val;

  for (i = 2; i < 32 ; i += 2)
    if((a = rotate_left (val, i)) <= 0xFF)
      return a | (i << 7) ; /* 12-bit pack: [shift-cnt,const].  */
  return FAIL;
}
<--

shall I produce a patchfile ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]