[llvm-bugs] [Bug 51907] New: wrong code at -Os
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Sep 19 06:58:18 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51907
Bug ID: 51907
Summary: wrong code at -Os
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: suochenyao at 163.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
int printf(const char *, ...);
int a = 5;
int *b = &a;
long c = 0;
int main() {
int d = -1L;
for (; c != 9; c = c + 3) {
*b &= 0 != 8;
*b ^= d;
}
printf("%d\n", a);
}
*******************************************************************************
clang version:
$ clang -v
clang version 14.0.0 (/data/src/llvm-dev/llvm-project/clang
b7ec8f3dcbcdf6d27902688c8eac0e6196061cb3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/bin/llvm-dev/bin
Found candidate GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Selected GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 10.2
*******************************************************************************
Command Lines:
$ clang a.c -o a1.out
$ clang -Os a.c -o as.out
$ ./a1.out
-2
$ ./as.out
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/20210919/290d5274/attachment.html>
More information about the llvm-bugs
mailing list