bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/19222] New: Undefined behavoour in tc-arm.c:encode_arm_imm


From: chrisj at rtems dot org
Subject: [Bug binutils/19222] New: Undefined behavoour in tc-arm.c:encode_arm_immediate with Xcode 7.1
Date: Tue, 10 Nov 2015 01:21:38 +0000

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

            Bug ID: 19222
           Summary: Undefined behavoour in tc-arm.c:encode_arm_immediate
                    with Xcode 7.1
           Product: binutils
           Version: 2.25
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: chrisj at rtems dot org
  Target Milestone: ---

The function 'encode_arm_immediate' in tc-arm.c does not compile RTEMS 4.11 ARM
GCC on OS X. The error reported is:

../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S: Assembler messages:
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:567: Error: invalid
constant (ff) after fixup
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:673: Error: invalid
constant (ff) after fixup
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:689: Error: invalid
constant (fd) after fixup
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:875: Error: invalid
constant (ff) after fixup
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:912: Error: invalid
constant (fd) after fixup
../../../../gcc-4.9.3/libgcc/config/arm/ieee754-df.S:985: Error: invalid
constant (fd) after fixup

The error has been reported to Apple and they have have said the error is due
to undefined behaviour in the function. A possible solution is:

@@ -9,7 +9,7 @@ encode_arm_immediate (unsigned int val)
   printf("val = %08x\n", val);

   for (i = 0; i < 32; i += 2)
-    if ((a = (val << i | val >> (32 - i))) <= 0xff)
+    if ((a = (val << i | (i == 0 ? 0:val >> (32 - i)))) <= 0xff)
       return a | (i << 7);

   return (-1);

-- 
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]