[llvm-bugs] [Bug 34381] New: Clang produces incorrect code at -O0
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 30 07:26:43 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34381
Bug ID: 34381
Summary: Clang produces incorrect code at -O0
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: Vsevolod.Livinskij at frtk.ru
CC: llvm-bugs at lists.llvm.org
Clang produces wrong-code with -O0.
>$ cat driver.cpp
#include <stdio.h>
extern const signed char var_11;
extern const unsigned int var_21;
extern const signed char var_29;
extern signed char var_370;
extern unsigned int var_390;
const signed char var_11 = 97;
const unsigned int var_21 = 3536697529U;
const signed char var_29 = 20;
signed char var_370 = 16;
unsigned int var_390 = 1082014357U;
extern void foo ();
int main () {
foo ();
printf("%llu\n", var_390);
return 0;
}
>$ cat func.cpp
extern const signed char var_11;
extern const unsigned int var_21;
extern const signed char var_29;
extern signed char var_370;
extern unsigned int var_390;
void foo() {
var_390 = !char((var_21 < -var_29) + ~0);
var_370 = short(var_11);
}
>$ clang++ -O1 driver.cpp func.cpp ; ./a.out
1
>$ clang++ -O0 driver.cpp func.cpp ; ./a.out
0
clang version 6.0.0 (trunk 311997)
--
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/20170830/98b74f06/attachment.html>
More information about the llvm-bugs
mailing list