[llvm-bugs] [Bug 26826] New: scan-build does not catch returning pointers to local storage
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 2 16:52:55 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26826
Bug ID: 26826
Summary: scan-build does not catch returning pointers to local
storage
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: swilliams at taranawireless.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The attached file shows a function returns a pointer to an array in its local
stack frame to its caller. This is dangerous, because an interrupt or other
intervening function call made by the caller before referencing this returned
pointer can clobber this region of memory, resulting in garbage values.
I would have expected the static analyzer to flag this as questionable, but
scan-build clang -O3 -Wall -c returns_pointer_to_local.c
yields only:
scan-build: Using '/home/swilliams-local/src/llvm-build/bin/clang-3.9' for
static analysis
scan-build: Removing directory '/tmp/scan-build-2016-03-02-165148-28031-1'
because it contains no reports.
scan-build: No bugs found.
--
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/20160303/a957d29d/attachment-0001.html>
More information about the llvm-bugs
mailing list