https://bugs.llvm.org/show_bug.cgi?id=37766
Bug ID: 37766
Summary: Uninitialized bool values accessed by optimizer
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: t...@iki.fi
CC: llvm-bugs@lists.llvm.org
This happens with v3.8.0 and in 6.0.0 git version from 13 Sep 2017, so I'd
expect it to still happen with newer versions. Using valgrind shows that the
"set" variable is accessed, even though ret==false always so it's not supposed
to be accessed. Doesn't happen if foo() is in the same .c file.
/* test2.c */
#include <stdbool.h>
_Bool foo(_Bool *value_r)
{
return false;
}
/* test.c */
#include <stdio.h>
#include <stdbool.h>
_Bool foo(_Bool *value_r);
int main(void)
{
bool set;
bool ret = foo(&set);
if (ret && set)
printf("foo\n");
if (!ret)
return 1;
return 0;
}
clang test2.c -c -o test2.o
clang -O2 -g test.c test2.o -o test
valgrind ./test
==28241== Conditional jump or move depends on uninitialised value(s)
==28241== at 0x4004E9: main (test.c:10)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs