|
|
| Bugzilla Link |
33695 |
| Resolution |
FIXED |
| Resolved on |
Jan 01, 2019 07:50 |
| Version |
trunk |
| OS |
All |
| Blocks |
#33196 |
| CC |
@dbabokin,@chengniansun,@majnemer,@zmodem,@hfinkel,@nunoplopes,@regehr,@sanjoy,@rotateright,@zhendongsu,@Vsevolod-Livinskij |
Extended Description
clang trunk (also reproducible with 4.0, not reproducible with 3.9), x86_64.
cat f.cpp
#include <stdio.h>
unsigned char uc = 170;
unsigned char var_1 = 252;
unsigned int var_33 = 1346838541U;
unsigned char var_36;
void foo() {
var_36 = (((var_33 | (0xaf2597a4 | uc)) << 26) - var_1) * 70983U;
}
int main() {
foo();
printf("result: %d\n", var_36);
return 0;
}
clang++ -O0 f.cpp -o out0
./out0
result: 28
clang++ -O2 f.cpp -o out2
./out2
result: 0
Opt-bisect points to "Combine redundant instructions on function", which removes the calculations and foo() and stores 0 to var_36, which is incorrect value.