[LLVMbugs] [Bug 17571] New: Wrong constant folding

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 14 06:50:43 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17571

            Bug ID: 17571
           Summary: Wrong constant folding
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

LLVM + clang (trunk) for ARM miscompiles the following code with
optimization level -O1.


/*
  $ clang -target arm-linux-gnueabi -I /usr/arm-linux-gnueabi/include
-mthumb -c error.c -o error.o -O1
  $ arm-linux-gnueabi-gcc error.o -o error.out
  $ qemu-arm -L /usr/arm-linux-gnueabi/ ./error.out
  @NG@ t = 4294967296

  $ clang -v
  clang version 3.4 (http://llvm.org/git/clang.git
890a1baadf4bd4c0ef0e8cd9ba30ecdea48d75a6)
(http://llvm.org/git/llvm.git
4fc2774b438c6c09f487362e53d5ac1a84edea73)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
*/

#include <stdio.h>

int main (void)
{
  volatile int x = 1;
  long long t = ( x & 2147483648LL ) << 1;
  if (t != 0LL) { printf("@NG@ t = %lld\n", t); }
  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131014/835b8392/attachment.html>


More information about the llvm-bugs mailing list