[LLVMbugs] [Bug 22077] New: MemorySanitizer false positive with -O2 or higher
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 1 07:04:41 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22077
Bug ID: 22077
Summary: MemorySanitizer false positive with -O2 or higher
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: oliverst at online.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 13616
--> http://llvm.org/bugs/attachment.cgi?id=13616&action=edit
preprocessed C source code
This code
#include <string>
void func(const char* s)
{
if(s== NULL)
{
}
}
int main()
{
func((std::string("const ") + "manager").c_str());
return 0;
}
generates the following warning when compiled with "-fsanitize=memory
-fsanitize-memory-track-origins -O2". It also happens with -O3, but not with
-O1 or without optimizations.
==13491== WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f74e825e04b in main (/home/notroot/trunk/a.out+0x8f04b)
#1 0x7f74e6dbbec4 in __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:287
#2 0x7f74e825da5c in _start (/home/notroot/trunk/a.out+0x8ea5c)
Uninitialized value was created by an allocation of '' in the stack frame of
function 'main'
#0 0x7f74e825db60 in main (/home/notroot/trunk/a.out+0x8eb60)
SUMMARY: MemorySanitizer: use-of-uninitialized-value ??:0 main
I am using the official clang 3.5 binaries from llvm.org on ubuntu 14.04.
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64
--
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/20150101/5f97dc1b/attachment.html>
More information about the llvm-bugs
mailing list