[llvm-bugs] [Bug 37766] New: Uninitialized bool values accessed by optimizer
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 11 05:59:02 PDT 2018
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: unassignedclangbugs at nondot.org
Reporter: tss at iki.fi
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180611/dce2efc5/attachment.html>
More information about the llvm-bugs
mailing list