[llvm-bugs] [Bug 45734] New: missing warning for uninitialized struct member
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 29 08:36:56 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45734
Bug ID: 45734
Summary: missing warning for uninitialized struct member
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: arnd at linaro.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Test-building linux kernels, I found new bugs with gcc-10 that neither older
gcc versions nor clang report. See this example at https://godbolt.org/z/pYDWPx
struct s {
int a; // always initialized
int b; // partially initialized, gcc-10 warns
int c; // not initialized, no warning
};
void f(void *p, int flag)
{
struct s s;
s.a = 0;
if (flag)
s.b |= 1;
else
s.b &= ~1;
__builtin_memcpy(p, &s, sizeof(s));
}
Ideally there would be a warning for both s.b and s.c, but clang currently
warns for neither struct member.
--
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/20200429/c47cf7fe/attachment.html>
More information about the llvm-bugs
mailing list