[llvm-bugs] [Bug 28504] New: Wrong constant folding

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 11 09:38:54 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28504

            Bug ID: 28504
           Summary: Wrong constant folding
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

LLVM + clang 3.9 for x86_64 miscompiles the following code.

% cat test.c
int main (void)
{
  signed char c = 1;
  int i = (short) (signed char) ( c - (unsigned char) c + (c==1) ) ;
  short s = c;

  if (i != 1) __builtin_abort();

  return 0;
}

% clang-3.9 test.c
% ./a.out
zsh: abort (core dumped)  ./a.out

% clang-3.9 -v
clang version 3.9.0 (trunk 274023)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /xxxxx/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.1
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20160711/57e31d0c/attachment.html>


More information about the llvm-bugs mailing list