Skip to content

Miscompilation at O3 #100298

Closed
Closed
@dtcxzyw

Description

@dtcxzyw
#include "csmith.h"
uint32_t a;
int16_t c;
void d() {
  for (a = -15; a >= 6; a = safe_add_func_uint16_t_u_u(a, 9))
    ;
  c = safe_lshift_func_int16_t_s_u(safe_lshift_func_uint16_t_u_s(a,14), 0);
}
int main() {
  d();
  printf("%d\n", c);
  return 0;
}
dtcxzyw@dtcxzyw:~/WorkSpace/Projects/compilers/LLVM/llvm-build$ gcc -O0 test.c -fsanitize=undefined -I/usr/include/csmith -w
dtcxzyw@dtcxzyw:~/WorkSpace/Projects/compilers/LLVM/llvm-build$ ./a.out 
-16384
dtcxzyw@dtcxzyw:~/WorkSpace/Projects/compilers/LLVM/llvm-build$ bin/clang -O3 test.c -I/usr/include/csmith -w
dtcxzyw@dtcxzyw:~/WorkSpace/Projects/compilers/LLVM/llvm-build$ ./a.out 
0

llvm version: 2d6ff0c

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions