[llvm-bugs] [Bug 52343] New: No warning when dereferencing pointers within a (fixed-size) array
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 29 00:41:19 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52343
Bug ID: 52343
Summary: No warning when dereferencing pointers within a
(fixed-size) array
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: eyalroz1 at gmx.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Consider the following two functions:
void foo() {
int *as[2];
*(as[0])=1;
}
void bar() {
int i = 0;
int *as[2];
for(i=0;i<1;i++)
{
*(as[i])=i;
}
}
for both of them, a warning should be issued about the dereferencing of an
uninitialized pointer. clang does not issue a warning on any of them when
compiling with -Wall.
See this on GodBolt: https://godbolt.org/z/e98GW679v
Related GCC bug (which does issue a warning for the first function):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102996
--
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/20211029/0acd566b/attachment-0001.html>
More information about the llvm-bugs
mailing list